Notepad++ has an issue where it breaks the syntax-highlighting when using a backtick escape sequence inside a template literal.

Highlight Issue

It doesn't happen when escaping a single quote in a single quote string and the same for the double quote.

Is there any way I can fix this somehow or do I have to wait for it to be fixed in a future version?

I have seen some things online about User Defined Languages but don't think it would help.

  • Which language is used for the code, or alternatively, what is the extension of the file-name? – harrymc Dec 7 '18 at 10:51
  • @harrymc JavaScript (extension .js). – user7393973 Dec 7 '18 at 11:23

Back-quotes are not meant in JavaScript for quoting strings, but rather for evaluating string-type expressions.

For example, this will call a function and replace the expression inside ${} with the returned value :

`header ${ myfunction() }`

The fact that back-quotes work for you the same as ordinary quotes is unintended and Notepad++ support for them is only only partial. To delimit strings that don't contain evaluated expressions you should be using quotes, single or double.

If you still wish to create your own syntax for Notepad++ where back-quotes have the same meaning as quotes, you will need to modify the syntax of JavaScript and create your own language.

References :

  • But I do use them to evaluate strings, variables, calculations, and so on together. User Defined Languages have limitations which make them not being able to replicate a built-in language. I was looking for a way to maybe change the built-in JavaScript syntax highlight. – user7393973 Dec 7 '18 at 13:41
  • You will have to define your own language, or to modify the definition of the JavaScript language. You can start with my above link. – harrymc Dec 7 '18 at 13:44

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.