microsoft / TypeScript-Sublime-Plugin

IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins
Apache License 2.0
1.72k stars 237 forks source link

Typescript syntax highlighting issue #714

Open Parallelogramist opened 5 years ago

Parallelogramist commented 5 years ago

Hi! I found a syntax highlighting condition that breaks highlighting for all subsequent blocks of code. Please let me know if you need more information.

Sublime Text 3: 3.2.1 build 3207 TypeScript plugin: v3.4.1

Image:

Screen Shot 2019-04-10 at 9 15 19 AM

Code:

if (something) {
    // if the function param is broken onto a new line then the following block's syntax is highlighted correctly
    _.each([], (item) => { 
        if (item) { count++; }
    });
}

// here to demonstrate that syntax highlighting works as expected
if (invalid) {
    let something = true;
    const something = true;
    this.something = true;
}

// the problematic line has to be within a block to demonstrate the issue
if (something) {
    // if the function param is all in one line then the following blocks lose syntax highlighting
    _.each([], (item) => { if (item) { count++; } });
    // sytax highlighting still works for the current block
    let something = true;
    const something = true;
    this.something = true;
}

// here to demonstrate that syntax highlighting does NOT work as expected
if (invalid) {
    let something = true;
    const something = true;
    this.something = true;
}
NobleUplift commented 5 years ago

Does it cause your Sublime Text 2 to almost completely freeze and crash? If so I'm getting this too.

NobleUplift commented 5 years ago

I checked out 3.1.0 and it seems to be working. It seems to be a bug with something that was added later.

Parallelogramist commented 5 years ago

I am using Sublime Text 3: 3.2.1 build 3207. It does not cause a crash, but simply breaks syntax highlighting for lines after the line that causes the issue as demonstrated in the attached screenshot.

I did not check in Sublime Text 2, but if it causes a freeze and crash then that's more important than syntax highlighting issues.

NobleUplift commented 5 years ago

It definitely causes a crash in 3.3.3333 and 3.4.1. Those are the last two versions I used. If I get more information I'll make it into a separate issue.

NobleUplift commented 5 years ago

Done. Tested again and created issue #718.