JavaScript highlighting broken for chained property preceded by function call and comment—everything parenthesized
The JavaScript syntax highlighting for chained properties preceded by a function call and a comment — with everything in parentheses — is broken in gedit 3.36.1-1 using gtksourceview 4.6.0-1 (on Gnome 3.36.1-1, Arch Linux). See the example source code and screenshot below.
It seems that this always occurs with a sequence like ( + [method or function call] + [comment] + [chained property] + ).
Note: The highlighting is broken for any property access. Well-known methods like .map
and an argument provide the best example for this issue, although just .map
instead of .map(Boolean)
would also demonstrate the issue.
Another JS highlighting bug (#116 (closed)) has been recently fixed, but I don’t currently have the latest (pre-release) gtksourceview version, so I don’t know if this issue is still present in an upcoming release.
// Broken syntax highlighting:
console.log(Array.from("") // Comment
.map(Boolean));
console.log(Array.from("") /* This multi-line comment
can have one or more lines. */ .map(Boolean));
(x() // Comment
.map(Boolean) // Comment – This line.
.map(Boolean)) // Comment
.map(Boolean);
(x()
.map(Boolean) // Comment
.map(Boolean)) // Comment – This line.
.map(Boolean);
(anyFunction() // Comment
.map("First argument and method name broken", "Second argument working")
.map("This line is working"));
// Working syntax highlighting:
console.log(Array.from("")
.map(Boolean));
x() // Comment
.map(Boolean);
Array.from("") // Comment
.map(Boolean);
[] // Comment
.map(Boolean);
([]) // Comment
.map(Boolean);
([] // Comment
.map(Boolean));
([] // Comment
.map(Boolean));
(anyObject // Comment
.map(Boolean));
((anyObject) // Comment
.map(Boolean));
console.log(Array.from(""). // Comment
map(Boolean));
anyFunction() // Comment
.map("First argument working", "Second argument working")
.map("This line is working");
(anyFunction()
.map("First argument working", "Second argument working")
.map("This line is working"));