mxw / vim-jsx

React JSX syntax highlighting and indenting for vim.
1.59k stars 95 forks source link

Support ES6 template literals #167

Closed alxdnlnko closed 6 years ago

alxdnlnko commented 6 years ago

It seems to be not so difficult to support ES6 template literals.

It is already used in new Polymer projects and lit-html.

render() {
  return html`
    <h1>Hello</h1>
  `
}

Tried to redefine the jsTemplateString region (added jsxRegion to it), and it works, but I don't know the right way of doing this :)

syntax region  jsTemplateString   start=+`+  skip=+\\`+  end=+`+     contains=jsTemplateExpression,jsSpecial,jsxRegion,@Spell extend
jonsmithers commented 6 years ago

I attempted to adapt vim-jsx for this purpose and came up with a separate plugin: https://github.com/jonsmithers/experimental-lit-html-vim

mxw commented 6 years ago

This is probably most suitable for the base JS/ES plugin rather than vim-jsx. Maybe submit a PR to vim-javascript?