Commit: runtime(make): Makefile highlighting breaks with ')' in string

0 views
Skip to first unread message

Christian Brabandt

unread,
4:45 PM (4 hours ago) 4:45 PM
to vim...@googlegroups.com
runtime(make): Makefile highlighting breaks with ')' in string

Commit: https://github.com/vim/vim/commit/519dc391d8fe2f2182160027d2cecc154ea749d0
Author: Beleswar Prasad Padhi <beleswa...@gmail.com>
Date: Tue Dec 23 21:32:10 2025 +0000

runtime(make): Makefile highlighting breaks with ')' in string

Problem: Makefile syntax highlighting incorrectly ends function calls
when encountering ')' inside double or single quoted strings,
causing incorrect highlighting for the remainder of the line.
Solution: Add makeDString and makeSString to the contains list for
makeIdent regions. This allows strings to be recognized inside
variable references and function calls.

fixes: #18687
closes: #18818

Signed-off-by: Beleswar Prasad Padhi <beleswa...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/syntax/make.vim b/runtime/syntax/make.vim
index dc649b125..8af09954b 100644
--- a/runtime/syntax/make.vim
+++ b/runtime/syntax/make.vim
@@ -8,6 +8,7 @@
" 2025 Oct 12 by Vim project: update makeDefine highlighting (#18403)
" 2025 Oct 25 by Vim project: update makeTargetinDefine highlighting (#18570)
" 2025 Dec 23 by Vim project: fix too greedy match (#18938)
+" 2025 Dec 23 by Vim project: wrong highlight with paranthesis inside quotes (#18818)

" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -42,15 +43,15 @@ syn match makeIdent "\$\$\$\$\w*" containedin=makeDefine
syn match makeIdent "\$[^({]"
syn match makeIdent "\$\$[^({]" containedin=makeDefine
if get(b:, 'make_flavor', s:make_flavor) == 'microsoft'
- syn region makeIdent start="\$(" end=")" contains=makeStatement,makeIdent
- syn region makeIdent start="\${" end="}" contains=makeStatement,makeIdent
- syn region makeIdent start="\$\$(" end=")" containedin=makeDefine contains=makeStatement,makeIdent
- syn region makeIdent start="\$\${" end="}" containedin=makeDefine contains=makeStatement,makeIdent
+ syn region makeIdent start="\$(" end=")" contains=makeStatement,makeIdent,makeDString,makeSString
+ syn region makeIdent start="\${" end="}" contains=makeStatement,makeIdent,makeDString,makeSString
+ syn region makeIdent start="\$\$(" end=")" containedin=makeDefine contains=makeStatement,makeIdent,makeDString,makeSString
+ syn region makeIdent start="\$\${" end="}" containedin=makeDefine contains=makeStatement,makeIdent,makeDString,makeSString
else
- syn region makeIdent start="\$(" skip="\)\|\\" end=")" contains=makeStatement,makeIdent
- syn region makeIdent start="\${" skip="\}\|\\" end="}" contains=makeStatement,makeIdent
- syn region makeIdent start="\$\$(" skip="\)\|\\" end=")" containedin=makeDefine contains=makeStatement,makeIdent
- syn region makeIdent start="\$\${" skip="\}\|\\" end="}" containedin=makeDefine contains=makeStatement,makeIdent
+ syn region makeIdent start="\$(" skip="\)\|\\" end=")" contains=makeStatement,makeIdent,makeDString,makeSString
+ syn region makeIdent start="\${" skip="\}\|\\" end="}" contains=makeStatement,makeIdent,makeDString,makeSString
+ syn region makeIdent start="\$\$(" skip="\)\|\\" end=")" containedin=makeDefine contains=makeStatement,makeIdent,makeDString,makeSString
+ syn region makeIdent start="\$\${" skip="\}\|\\" end="}" containedin=makeDefine contains=makeStatement,makeIdent,makeDString,makeSString
endif
syn match makeIdent "^ *[^:#= ]*\s*[:+?!*]="me=e-2
syn match makeIdent "^ *[^:#= ]*\s*::="me=e-3
diff --git a/runtime/syntax/testdir/dumps/make_01_00.dump b/runtime/syntax/testdir/dumps/make_01_00.dump
index 3ac6700ec..d476fcd2a 100644
--- a/runtime/syntax/testdir/dumps/make_01_00.dump
+++ b/runtime/syntax/testdir/dumps/make_01_00.dump
@@ -7,14 +7,14 @@
| +0#e000e06&@7|@|e+0#e000002&|c|h|o| |d|o|u|b|l|e|-|c|o|l|o|n| |r|u|l|e| +0#0000000&@43
@75
|$+0#00e0e07&|(|a|)| |++0#0000000&|=| |o|u|t|p|u|t| @60
+@75
+|d+0#e000e06&|e|f|i|n|e| |s|a|y| +0#0000000&@64
+| +0#e000e06&@7|e|c|h|o| |$+0#00e0e07&|1| +0#0000000&@59
+|e+0#e000e06&|n|d|e|f| +0#0000000&@69
+@75
+|d+0#00e0e07&|e|f|a|u|l|t|:| +0#0000000&@66
+| +0#e000002&@7|$+0#00e0e07&|(|c+0#af5f00255&|a|l@1| +0#00e0e07&|s|a|y|,|"+0#e000002&|H|e|l@1|o| |(|w|o|r|l|d|)|!|"|)+0#00e0e07&| +0#0000000&@38
|~+0#4040ff13&| @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/make_01.mak b/runtime/syntax/testdir/input/make_01.mak
index 28c6147e6..e97c13c0a 100644
--- a/runtime/syntax/testdir/input/make_01.mak
+++ b/runtime/syntax/testdir/input/make_01.mak
@@ -7,3 +7,10 @@ $(a)::
@echo double-colon rule

$(a) += output
+
+define say
+ echo $1
+endef
+
+default:
+ $(call say,"Hello (world)!")
Reply all
Reply to author
Forward
0 new messages