[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64792: js-mode doesn't recognize LS and PS line endings, leading to
From: |
Clément Pit-Claudel |
Subject: |
bug#64792: js-mode doesn't recognize LS and PS line endings, leading to incorrect syntax highlighting |
Date: |
Sat, 22 Jul 2023 18:41:42 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
Hi all,
The following code prints "Hello," and "world!" in JavaScript:
//
console.debug("Hello,");
//
console.debug("world!");
There is a LINE SEPARATOR after the first //, and a PARAGRAPH SEPARATOR after
the second //. Both of these are valid line terminators in ECMAScript
(https://262.ecma-international.org/10.0/#table-33), but since js-mode does not
recognize them, it displays the whole buffer in comment face (the only
indication that something fishy is going on is a thin box around each
character).
Other editors handle this in various ways. gedit treats LS and PS as line
breaks, but still displays the first call to console.debug in comment face.
vscode displays both LS and PS as question marks but warns about them and
highlights the code correctly.
Is there an easy way to make Emacs treat LS and PS as newlines in js-mode?
Ideally it would display the calls to console.debug on their own separate
lines, like this:
//[LS]
console.debug("Hello,");
//[PS]
console.debug("world!");
… but it would already be nice to fix the syntax highlighting to not use the
comment font. For that these characters could be marked as comment enders.
There may be additional work to do to check uses of \n of "^" and "$" in
regular expressions, too.
Clément.
- bug#64792: js-mode doesn't recognize LS and PS line endings, leading to incorrect syntax highlighting,
Clément Pit-Claudel <=