New issue
Advanced search Search tips

Issue 675502 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

String literal highlighting in TypeScript wrong end brace

Reported by roger@versluis.ca, Dec 19 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36 OPR/42.0.2393.85

Steps to reproduce the problem:
1. Run following typescript code:

export class Class2 {

}

export class Class1 implements Class2 {
    private test1(test: string): void {
        return null;
    }

    public async test2(): Promise<void> {
        console.log('destroying tables');

        for (let i = 0; i < 1; i++) {

            const assignment = i;

            const line = `Test [${assignment}]`;

            let a = 0;
        }

        console.log('another log');
    }
}

Open the dev tools / sources and check the file.

What is the expected behavior?
The string literal part on line 17 should just highlight Test [${assignment}]

What went wrong?
It is highlighting the rest of the file instead.

When clicking on the last curly brace after the word assignment it thinks that this is the closing brace for the for loop, which is incorrect.

This only seems to happen when in a scope inside a function, inside a class that implements another class.

See attached screenshot.

Did this work before? No 

Chrome version: 55.0.2883.75  Channel: stable
OS Version: 10.0
Flash Version:
 
Untitled.png
17.2 KB View Download

Comment 1 by roger@versluis.ca, Dec 19 2016

You can still set a breakpoint on a broken line but it prevents hovering over variables to see their value. 
Labels: M-55
Owner: einbinder@chromium.org
Status: Assigned (was: Unconfirmed)
This appears to be a CodeMirror bug. I filed an issue. https://github.com/codemirror/CodeMirror/issues/4450

Comment 4 by roger@versluis.ca, Jan 9 2017

This bug got closed at CodeMirror because it seems to work on the latest version. Upgrading CodeMirror would most likely fix it in the developer tools too.

Comment 5 by zak.he...@gmail.com, Oct 25 2017

Bumping this issue as it's been 10 months. This may just be a version bump to the latest codemirror. Note that the same breakage can be witnessed in Codemirror if the language mode is set to javascript, but it is ok in typescript. I wonder if the wrong language mode is being selected?


Screen Shot 2017-10-25 at 17.06.49.png
93.3 KB View Download
Screen Shot 2017-10-25 at 17.07.03.png
96.2 KB View Download

Comment 6 by roger@versluis.ca, Oct 25 2017

I updated the CodeMirror bug here:
https://github.com/codemirror/CodeMirror/issues/4450

String literals are valid even in Javascript, but indeed Chrome should set the mode to Typescript when displaying a TS file.

Comment 7 by roger@versluis.ca, Nov 16 2017

I was going to give this bug a go today but when I installed Canary it looks like this bug resolved itself already.

Sign in to add a comment