Thom1729 / Sublime-JS-Custom

Customizable JavaScript syntax highlighting for Sublime Text.
MIT License
137 stars 9 forks source link

flow_types breaks highlighting after ternary and bitshift #132

Closed mischnic closed 1 year ago

mischnic commented 2 years ago

Sublime Text build number

4121

Example Code

const recordDefinition = (a) => {
    return a ? (a) : (a << 5);
};
d[105] = (data)=>{
    if (token >= 144 && token < 160 || token == 220 || token == 221) target = [];
    else target = {};
};
d[115] = ()=>new Set(read());
const typedArrays = ['BigUint64'].map((type)=>type + 'Array');

JS Custom Preferences

{
    "configurations": {
        "Default": {}
    },
    "defaults": {
        "file_extensions": ["js", "jsx"],
        "flow_types": true,
        "jsx": true
    }
}

Configuration name

JS Custom - Default

Description

The second line breaks the highlighting for the rest of the file.

It works correctly with "flow_types": false

Bildschirmfoto 2021-11-21 um 13 30 02

Thom1729 commented 2 years ago

Minimal example:

return a ? (a) : (a < 5);
let x;

The bug is in Flow only, not in TypeScript, so there should hopefully be a simple fix.

Thom1729 commented 2 years ago

This should be fixed in 4.3.0-beta.2.