You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems function-literal indentation is not properly handled in some cases. Examples include function-literals in arrays, and assignment to the result of a function call with a function-literal argument:
foo=bar(function(){blah});foo([function(){}]);
Detecting each such case is probably not necessary. Can't we just look back for the regex \bfunction *(\( *[a-zA-Z$_][a-zA-Z0-9$_]*\)* *) *{ *\n * or so (emacs regex).
(I probably left out some valid identifier characters from the []. And I disregarded tabs.)
I should point out that the new js2-mode on GitHub has this issue fixed. Unfortunately it's still not the first Google hit for "js2-mode": https://github.com/mooz/js2-mode
The text was updated successfully, but these errors were encountered:
js2-mode's issue would be different since it has entirely different indentation code. Where possible I don't use regexes since the language is too complex (just put a regular expression literal containing slashes in that chain).
There are a number of special cases that I'd like to handle differently, but there are caveats to all of them. I think I'll put a page up on the wiki soon detailing the problem.
It seems function-literal indentation is not properly handled in some cases. Examples include function-literals in arrays, and assignment to the result of a function call with a function-literal argument:
Detecting each such case is probably not necessary. Can't we just look back for the regex
\bfunction *(\( *[a-zA-Z$_][a-zA-Z0-9$_]*\)* *) *{ *\n *
or so (emacs regex).(I probably left out some valid identifier characters from the []. And I disregarded tabs.)
I should point out that the new js2-mode on GitHub has this issue fixed. Unfortunately it's still not the first Google hit for "js2-mode": https://github.com/mooz/js2-mode
The text was updated successfully, but these errors were encountered: