-
-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
js2-PRIVATE_NAME is breaking js2-skip-preprocessor-directives #585
Comments
Hi! These features conflict quite a bit, though. How do we disambiguate? Do we disable private names altogether when Or do we keep the list of allowed PP directives? And/or perhaps exclude |
Hello! I don't know if there's an official spec for shebangs, but https://en.wikipedia.org/wiki/Shebang_(Unix) says that they only appear at the very beginning of a script, and that's where I've always seen them. I believe that when Would it be possible for js2-mode to do a one-off check of the very first character in a file, and if it's |
Yeah, that would be easy enough. Just skip it before starting to parse. Added that on master. I was wondering also whether somebody has ideas on what to do with actual preprocessor directives, like in https://github.com/mozilla/gecko-dev/blob/master/browser/app/profile/firefox.js#L16-L20 But maybe Firefox devs don't use this package anymore. |
What about considering the context of the |
That's an option, but preprocessor macros could be used inside class declarations, I suppose. |
Thanks @dgutov. My issue is solved -- I only use shebangs, not preprocessor directives. I can leave this open, though, since it seems the issue of fixing preprocessor directives is still open. |
That's the idea. And thanks for checking. |
Repro:
(setq js2-skip-preprocessor-directives t)
Check
js2-parsed-errors
. It should be nil, but it will be:js2-mode thinks the token type of the first character (
#
) is 177, which isjs2-PRIVATE_NAME
, introduced in fc82b04 to address #537The text was updated successfully, but these errors were encountered: