Search code examples
notepad++

Notepad++ syntax highlighting: How to declare `number` and `boolean` as non-keywords for JavaScript?


By default number and boolean seem to be considered keywords if you switch to "language -> JavaScript" in Notepad++ (actually I do not even know why) and therefore they are specially highlighted. What is the simplest way (using UDL or whatever) to declare them as non-keywords so that Notepad++ does not specially highlight them any longer in JavaScript mode?

[EDIT] Okay, I found out that at least for number it is quite easy - you can change your theme specific style configuration: Go to Settings > Style Configurator and select Language: JavaScript and Style: Keyword then under User-defined keywords you can remove number. But unfortunately boolean is added under Default keywords and you cannot edit those default keywords. What can I do?


Solution

  • For number it turned out to be quite easy - you can change your theme specific style configuration: Go to Settings > Style Configurator and select Language: JavaScript and Style: Keyword then under User-defined keywords you can remove number.

    As for the word boolean it turned out that boolean (in contrast to number) is (or was) indeed a keyword in JavaScript (see: https://www.w3schools.com/js/js_reserved.asp) - thanks a lot to Toto for that clarification (see comments above). To be more precise is was a "future reserved word" in JavaScript versions before ECMAScript5 (see here: Section "Removed Reserved Words" in https://www.w3schools.com/js/js_reserved.asp and https://262.ecma-international.org/11.0/#prod-ReservedWord). In modern JavaScript boolean is not a reserved word any longer.