0

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.

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

1 Answer 1

0

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 :

2
  • 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. Dec 7, 2018 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, 2018 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .