Skip to content

Commit

Permalink
Fix (or add explicit) shebang support
Browse files Browse the repository at this point in the history
  • Loading branch information
dgutov committed Apr 2, 2022
1 parent b9ed9e4 commit fed4161
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js2-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -5686,13 +5686,17 @@ A buffer can only have one scanner active at a time, which yields
dramatically simpler code than using a defstruct. If you need to
have simultaneous scanners in a buffer, copy the regions to scan
into temp buffers."
(with-current-buffer (or buf (current-buffer))
(save-excursion
(and buf (set-buffer buf))
(goto-char (point-min))
(when (looking-at "#!/")
(forward-line 1))
(setq js2-ts-dirty-line nil
js2-ts-hit-eof nil
js2-ts-line-start 0
js2-ts-lineno (or line 1)
js2-ts-line-end-char -1
js2-ts-cursor (point-min)
js2-ts-cursor (point)
js2-ti-tokens (make-vector js2-ti-ntokens nil)
js2-ti-tokens-cursor 0
js2-ti-lookahead 0
Expand Down

0 comments on commit fed4161

Please sign in to comment.