microsoft / TypeScript-TmLanguage

TextMate grammar files for TypeScript for VS Code, Sublime Text, and Atom.
MIT License
413 stars 126 forks source link

Specific JS construct breaks syntax highlighting #988

Open YellowAfterlife opened 1 year ago

YellowAfterlife commented 1 year ago

Does this issue occur when all extensions are disabled?: Yes

Snippet:

function one() {
    return (
        {
            toString: () => {
                return "Something";
            }
        }
    );
}

function two() {
    return "??";
}

Screenshot: image

Steps to Reproduce:

  1. Paste the following into a fresh file with JavaScript set as a language
  2. Observe keyword highlighting not working correctly for any functions following function one

This specific nesting (a lambda function with a block inside a property of an object inside parenthesis in a return statement) triggers the effect.

RedCMD commented 10 months ago

for a temporary workaround you can just place a comment with a = equal sign at the end of the line of the first return statement

Broken: image Workaround: image