Skip to content Skip to sidebar Skip to footer

Javascript Color Highlighting Error In Vscode

I have fresh install of VScode editor (v.1.14.2). Doesn't have any installed extensions. I have problem with javaScript highlighting in very simple file. The same code in Sublime

Solution 1:

You can use vscode command Developer: Inspect TM Scopes for scope inspection. This color changes because vscode thinks click(), addEventListener()... is special DOM-related properties and should be highlighted.

Workaround would be modifying monokai-color-theme.json in

Microsoft VS Code\resources\app\extensions\theme-monokai\themes.

In this array "tokenColors": [] add:

{"name":"DOM & invocation color fix","scope":"meta.function-call.js entity.name.function, meta.function-call.js support.function.dom.js","settings":{"foreground":"#66D9EF"}}

This will make function calls & DOM-methods sublime-like.

P.S. If theme updates it will most likely overwrite this file.

Edit:

From some version it is possible to modify theme from settings.jsonCtrl+,

"editor.tokenColorCustomizations":{"textMateRules":[{"scope":["meta.function-call.js entity.name.function","meta.function-call.js support.function.dom.js"],"settings":{"foreground":"#66D9EF"}}]}

Solution 2:

Your function should not have an end-line ";" added. Your variable test however should have one, this is simple syntax error and doesn't always get caught. This post is years late but it came up in search and the above suggestion is too much work.

Post a Comment for "Javascript Color Highlighting Error In Vscode"