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
558 stars 18 forks source link

Problem with flow generics in functions with multiline arguments #203

Open chmanie opened 5 years ago

chmanie commented 5 years ago

When using flow generics for functions at the same time as putting arguments in multiple lines the syntax highlighting breaks. Here's a simple example:

const foo = () => ();

const bar = <P: BarType>(
  barParam: string
) => ();

const baz = <P: BazType>() => ();

You will see that the last const is not highlighted properly anymore. I had the same problem with babel-sublime, so it might actually be a problem with the babel/flow parser? I'm not really sure.

borela commented 5 years ago

This is a limitation in sublime's regex engine where it can't match against multi line, this is why it works when you put everything on the same line :/ https://github.com/borela/naomi/issues/25