runtime(javascript): Fix regex highlighting after `(`
Commit:
https://github.com/vim/vim/commit/076366bd4e8b89e722efc72a1b62d5b3d2ba62e0
Author: Doug Kearns <[email protected]>
Date: Sun Apr 26 14:52:21 2026 +0000
runtime(javascript): Fix regex highlighting after `(`
- Fix regex highlighting after opening parens, javascriptParens was
matching later. Fixes issue https://github.com/vim/vim/issues/20069.
- Add missing regex flags.
- Mark the file as unmaintained. Thanks Claudio for all your work.
closes: #20076
Signed-off-by: Doug Kearns <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/syntax/javascript.vim b/runtime/syntax/javascript.vim
index c89fcedce..c910a668a 100644
--- a/runtime/syntax/javascript.vim
+++ b/runtime/syntax/javascript.vim
@@ -1,18 +1,12 @@
" Vim syntax file
-" Language: JavaScript
-" Maintainer: Claudio Fleiner <[email protected]>
-" Updaters: Scott Shattuck (ss) <[email protected]>
-" URL: http://www.fleiner.com/vim/syntax/javascript.vim
-" Changes: (ss) added keywords, reserved words, and other identifiers
-" (ss) repaired several quoting and grouping glitches
-" (ss) fixed regex parsing issue with multiple qualifiers [gi]
-" (ss) additional factoring of keywords, globals, and members
-" Last Change: 2022 Jun 09
-" 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke)
-" 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder)
-" 2024 Aug 14: fix a few stylistic issues (#15480)
-" 2025 Aug 07: as is a reserved keyword (#17912)
-" 2025 Sep 24: using is a reserved keyword (Devin Weaver)
+" Language: JavaScript
+" Maintainer: This runtime file is looking for a maintainer.
+" Previous Maintainer: Claudio Fleiner <[email protected]>
+" Contributors: Scott Shattuck <[email protected]>
+" Kevin Locke
+" LongJohnCoder
+" Devin Weaver
+" Last Change: 2026 Apr 26
" tuning parameters:
" unlet javaScript_fold
@@ -52,7 +46,14 @@ syn match javaScriptNumber
"\<\d\+\(_\d\+\)*[eE][+-]\?\d\+\>"
syn match javaScriptNumber
"\<[1-9]\d*\(_\d\+\)*\(\.\(\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\)\?\)\?\>"
syn match javaScriptNumber
"\<\(\d\+\(_\d\+\)*\)\?\.\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\>"
syn match javaScriptNumber
"\<\d\+\(_\d\+\)*\.\(\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\)\?\>"
-syn region javaScriptRegexpString start=+[,(=+]\s*/[^/*]+ms=e-1,me=e-1
skip=+\\\|\/+ end=+/[gimuys]\{0,2\}\s*$+
end=+/[gimuys]\{0,2\}\s*[+;.,)\]}]+me=e-1 end=+/[gimuys]\{0,2\}\s\+\/+me=e-1
contains=@htmlPreproc,javaScriptComment oneline
+syn region javaScriptRegexpString
+ \ start=+\%([,(=+]\s*\)\@8<=/[^/*]+
+ \ skip=+\\\|\/+
+ \ end=+/[dgimsuvy]\{0,7\}\ze\s*$+
+ \ end=+/[dgimsuvy]\{0,7\}\ze\s*[+;.,)\]}]+
+ \ end=+/[dgimsuvy]\{0,7\}\ze\s\+\/+
+ \ contains=@htmlPreproc,javaScriptComment
+ \ oneline
syn keyword javaScriptConditional if else switch
syn keyword javaScriptRepeat while for do in of
diff --git a/runtime/syntax/testdir/dumps/javascript_00.dump
b/runtime/syntax/testdir/dumps/javascript_00.dump
new file mode 100644
index 000000000..eca4c4b60
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/javascript_00.dump
@@ -0,0 +1,20 @@
+>/+0#0000e05#ffffff0@1| |I|s@1|u|e| |#|2|0@1|6|9| |(|J|a|v|a|S|c|r|i|p|t|
|s|y|n|t|a|x| |h|i|g|h|l|i|g|h|t|i|n|g| |n|o|t| |w|o|r|k|i|n|g|
|p|r|o|p|e|r|l|y| |w|i|t|h| |r
+|e|g|e|x| +0#0000000&@70
+|/+0#0000e05&@1| @2|p|a|t@1|e|r|n|s| |c|o|n|t|a|i|n|i|n|g| |q|u|o|t|a|t|i|o|n|
|m|a|r|k|s|)| +0#0000000&@33
+@75
+|c+0#af5f00255&|o|n|s|t| +0#0000000&|c|o|n|t|a|i|n|s|S|y|m|b|o|l|s| |=|
|p|a|s@1|w|o|r|d|.|m|a|t|c|h|(|/+0#e000002&|[|!|"|.@2|/|g|)+0#0000000&|;| @24
+@75
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1|
diff --git a/runtime/syntax/testdir/input/javascript.js
b/runtime/syntax/testdir/input/javascript.js
new file mode 100644
index 000000000..b0b76eca2
--- /dev/null
+++ b/runtime/syntax/testdir/input/javascript.js
@@ -0,0 +1,5 @@
+// Issue #20069 (JavaScript syntax highlighting not working properly with regex
+// patterns containing quotation marks)
+
+const containsSymbols = password.match(/[!".../g);
+
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1wH2bQ-002Vym-U8%40256bit.org.