microsoft / TypeScript-Sublime-Plugin

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

Incorrect colors in typescript code #680

Closed cfsmp3 closed 5 years ago

cfsmp3 commented 5 years ago

(originally posted here, but they sent me your way)

Doesn't happen to all the code, but it happens to this specific bit, see screenshot.

sublime_missingcolors

What is most interesting and I can't explain is that if I comment out that console.log line, everything works as expected.

sublime_colorsok

DanielRosenwasser commented 5 years ago

Are you using the most up-to-date version of the plugin, and if not, can you post a minimal reproduction of the code that has this error?

cfsmp3 commented 5 years ago

@DanielRosenwasser Yes, just checked, 3.1.1, and this simple thing triggers it:

sublime_minimal

Again commenting out that first console.log() line is enough to to get it to work as expected.

DanielRosenwasser commented 5 years ago

Can you post code as text? Screenshots aren't copy/paste-able for tests 😉

cfsmp3 commented 5 years ago

Sure @DanielRosenwasser . This should do:

Version with wrong colors:

function dummy()
{
    return Promise.all([])
        .then((result) => // Array of arrays (one array per user,each listing the token
     {
        const send_all_messages_promises = [];
        console.log('Result of device list', result);
        const usedTokens = {};
        for (const userdevicelist of result) {
            for (const registrationTokenObj of userdevicelist) {
                const registrationToken = registrationTokenObj.registrationToken;
                const deviceRef = registrationTokenObj.reference;
                console.log("Token", registrationToken);
            }
        }
    });
}

Version with correct colors:

function dummy () 
{
    return Promise.all ([])
        .then((result) =>
     {
        const send_all_messages_promises = [];
        console.log('Result of device list', result);
        const usedTokens = {};
        for (const userdevicelist of result) {
            for (const registrationTokenObj of userdevicelist) {
                const registrationToken = registrationTokenObj.registrationToken;
                const deviceRef = registrationTokenObj.reference;
                console.log("Token", registrationToken);
            }
        }
    });
}

It's the // Array of arrays (one array per user,each listing the token comment that causes the problem.

DanielRosenwasser commented 5 years ago

This issue was moved to Microsoft/TypeScript-TmLanguage#678

DanielRosenwasser commented 5 years ago

Released 3.1.5 with updated syntax highlighting.