borela / naomi

Sublime Text enhanced syntax highlighting for JavaScript ES6/ES7/ES2015/ES2016/ES2017+, Babel, FlowType, React JSX, Styled Components, HTML5, SCSS3, PHP 7, phpDoc, PHPUnit, MQL4. Basic: Git config files.
Other
557 stars 20 forks source link

multiline typed ES6 method heads break syntax highlighting #239

Open schumannd opened 4 years ago

schumannd commented 4 years ago

Whenever my arguments get too long for my max line length and i spread them out, naomi syntax highlighting breaks

// Works
funcA = async (arg1: string, arg2: string): Promise<boolean> => {};

// Doesn't work
funcA = async (
  arg1: string,
  arg2: string): Promise<boolean> => {};

The code below the function also gets highlighted incorrectly afterwards, depending on what (valid) js code the function contains.

Are there any other syntaxhighlighters that handle ES6 + typing (i.e. flowtype)? For now naomi seems to do the best job, so thanks for that!!

TomasBarry commented 4 years ago

Have also experienced this. Would be really nice to get a fix for it.

borela commented 4 years ago

Unfortunately this is a limitation in sublime's regex system, it only works on a line by line basis :c Some solutions have been proposed to the sublime dev's https://github.com/SublimeTextIssues/Core/issues/2241