es.next.syntax.vim
es.next.syntax.vim copied to clipboard
Syntax highlighting breaks when function body not surrounded with {}?
I'm using this following plugins:
Plugin 'othree/yajs.vim'
Plugin 'othree/es.next.syntax.vim'
Plugin 'mxw/vim-jsx'

Sometimes when returning an expression surrounded with (``), the syntax highlighting breaks, e.g.:
const preset = (context, { loose } = {}) => ({
plugins: [
...es2015,
...es2016,
...es2017,
].map((plugin) => [plugin, { loose }]),
})
This issue belongs to yajs.vim. And I still not able to solve it.
The problem is. These is another case I can't distinguish from this one:
(arg1) => (arg2) => (arg3, arg4) => (arg5, arg6) => true
Vim's syntax system cant look forward. So I have to tell is it a function or a paren when cursor at:
(arg1) => (arg2) => (arg3, arg4) => (arg5, arg6) => true
^
Ah, I see :( There are probably other syntax highlighters that have solved similar ambiguity in different languages, might be worth checking how they do it.