Skip to content

Commit e8b6098

Browse files
committed
syntax/go.vim: Fixed comments in certain places where expressions are expected (e.g. function arguments)
1 parent d581656 commit e8b6098

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
correctly
1717
- Fixed slice literals whose item type is a function with a return type
1818
- Fixed nested slice literals
19+
- Fixed comments in certain places where expressions are expected (e.g. function
20+
arguments)
1921

2022
## Version 0.2.0 - 2022/12/31
2123

syntax/go.vim

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ GoDeferCleanup delcom GoFoldStruct
109109

110110
" Two top-level clusters to allow regions to specify what syntax they can
111111
" contain
112-
syntax cluster goExpr contains=@goLiteral,goDotExpr,goFuncLiteral,goCommaExpr,goOperator,goWordStart,goParenBlock,goBracketBlock
113-
syntax cluster goStatement contains=@goExpr,@goFlowControl,goReturn,goSemicolon,goBraceBlock,goComment,goStatementStart,goConstDecl,goVarDecl,goTypeDecl,goKeywords
112+
syntax cluster goExpr contains=@goLiteral,goDotExpr,goFuncLiteral,goCommaExpr,goOperator,goWordStart,goParenBlock,goBracketBlock,goComment
113+
syntax cluster goStatement contains=@goExpr,@goFlowControl,goReturn,goSemicolon,goBraceBlock,goStatementStart,goConstDecl,goVarDecl,goTypeDecl,goKeywords
114114

115115
syntax match goIdentifier /\K\k*/ contained nextgroup=goDotExpr skipwhite
116116

@@ -307,8 +307,8 @@ syntax keyword goVarDecl var skipwhite skipnl nextgroup=goVarIdentifier,goVa
307307
" syntax region goVarDeclGroup matchgroup=goVarDeclParens start='(' end=')' contained contains=@goExpr,goComment,goSemicolon,goVarGroupIdentifier
308308
" syntax region goConstDeclGroup matchgroup=goConstDeclParens start='(' end=')' contained contains=@goExpr,goComment,goSemicolon,goVarGroupIdentifier,goIota
309309

310-
syntax region goVarDeclGroup matchgroup=goVarDeclParens start='(' end=')' contained contains=@goExpr,goComment,goSemicolon,goVarIdentifier
311-
syntax region goConstDeclGroup matchgroup=goConstDeclParens start='(' end=')' contained contains=@goExpr,goComment,goSemicolon,goVarIdentifier,goIota
310+
syntax region goVarDeclGroup matchgroup=goVarDeclParens start='(' end=')' contained contains=@goExpr,goSemicolon,goVarIdentifier
311+
syntax region goConstDeclGroup matchgroup=goConstDeclParens start='(' end=')' contained contains=@goExpr,goSemicolon,goVarIdentifier,goIota
312312

313313
" TODO: Is it worth supporting comments in goVarComma??
314314
syntax match goVarIdentifier /\<\K\k*/ contained skipwhite nextgroup=goVarComma,@goType
@@ -438,7 +438,7 @@ syntax match goSliceOrArrayLiteral /\k\@1<!\[[0-9.]*\]\ze\%(\*\|\K\|\[\|(\)/ con
438438
syntax region goSliceLiteralType start='\S' end='\ze{\|$' contained contains=goSliceLiteralTypeMatch skipwhite skipnl nextgroup=goSliceItems
439439
syntax match goSliceLiteralTypeMatch /\%(\%(interface\|struct\)\s*{\|[^{]\)\+/ contained contains=@goType
440440

441-
syntax region goSliceItems matchgroup=goSliceBraces start='{' end='}' contained contains=goStructLiteralBlock,@goExpr,goComment
441+
syntax region goSliceItems matchgroup=goSliceBraces start='{' end='}' contained contains=goStructLiteralBlock,@goExpr
442442

443443
syntax match goChannel /<-chan/ contained contains=goChannelDir skipwhite nextgroup=@goType
444444
syntax match goChannel /chan\%(<-\)\?/ contained contains=goChannelDir skipwhite nextgroup=@goType
@@ -578,7 +578,7 @@ syntax region goStructLiteralTypeArgs matchgroup=goTypeParamBrackets start='\['
578578
" goStructLiteralBlock contains itself to 1) prevent weird highlighting while
579579
" typing, and 2) allow slice literals of slices of structs to highlight
580580
" correctly
581-
GoFoldStruct syntax region goStructLiteralBlock matchgroup=goStructBraces start='{' end='}' contained contains=goStructLiteralField,goComma,@goExpr,goComment,goStructLiteralBlock
581+
GoFoldStruct syntax region goStructLiteralBlock matchgroup=goStructBraces start='{' end='}' contained contains=goStructLiteralField,goComma,@goExpr,goStructLiteralBlock
582582

583583
syntax match goStructLiteralField /\<\K\k*\ze:/ contained nextgroup=goStructLiteralColon
584584
syntax match goStructLiteralColon /:/ contained

0 commit comments

Comments
 (0)