michaelgmcd / vscode-language-babel

VSCode syntax highlighting for today's JavaScript
https://marketplace.visualstudio.com/items?itemName=mgmcdermott.vscode-language-babel
MIT License
131 stars 17 forks source link

Syntax highlighting of last template string in object literal is incorrect #23

Closed gknapp closed 6 years ago

gknapp commented 6 years ago

Issue Type: Bug

Define an object literal in a .js file, the syntax highlighting is incorrect (cannot reproduce with Babel JavaScript extension disabled). The value of the last field in the object literal is colored differently (see screenshot).

const paths = {
  assets: `${__dirname}/app/assets/files`,
  build: `${__dirname}/build`,
  index: "./app/index.jsx",
  openLayers: `${__dirname}/node_modules/ol`,
  template: `${__dirname}/app/index.html`
};

vscode-syntax-hl

VS Code version: Code 1.21.1 (79b44aa704ce542d8ca4a3cc44cfca566e7720f1, 2018-03-14T14:46:47.128Z) OS version: Windows_NT x64 10.0.16299

System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) CPU E5-2670 v3 @ 2.30GHz (48 x 2295)| |Memory (System)|63.77GB (44.25GB free)| |Process Argv|C:\Program Files\Microsoft VS Code\Code.exe| |Screen Reader|no| |VM|0%|
Extensions (11) |Extension|Author (truncated)|Version| |---|---|---| |vscode-toggle-quotes|Bri|0.2.0| |npm-intellisense|chr|1.3.0| |bracket-pair-colorizer|Coe|1.0.26| |vscode-eslint|dba|1.4.7| |EditorConfig|Edi|0.12.1| |svn-scm|joh|1.26.0| |vscode-language-babel|mgm|0.0.12| |PowerShell|ms-|1.6.0| |debugger-for-chrome|msj|4.2.1| |vscode-code-outline|pat|0.0.13| |vscode-todo-highlight|way|0.5.12|

Reproduces only with extensions

michaelgmcd commented 6 years ago

This is also an issue in the Atom package. It is not the ordering of the keys, but the fact that the name of the key is template. It appears that https://github.com/gandm/language-babel/commit/f06650979531359abc472f445d1e14e4e43e169e added functionality that assumes any object with the key template has a value that is actually a mustache template. I have removed support for this for now (to fix your issue), but I may have to re-enable it if people are actually using this feature. Please test this in the latest release