summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/go.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 07:39:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 07:39:41 +0000
commit00c068502d170f9f9b59c4a68aa12e8835859f6c (patch)
tree2047fc01b8c70326d9b87b47a575e7e5f2141b62 /runtime/syntax/go.vim
parentAdding upstream version 2:9.1.0016. (diff)
downloadvim-00c068502d170f9f9b59c4a68aa12e8835859f6c.tar.xz
vim-00c068502d170f9f9b59c4a68aa12e8835859f6c.zip
Adding upstream version 2:9.1.0199.upstream/2%9.1.0199
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--runtime/syntax/go.vim29
1 files changed, 20 insertions, 9 deletions
diff --git a/runtime/syntax/go.vim b/runtime/syntax/go.vim
index 4272e80..8685867 100644
--- a/runtime/syntax/go.vim
+++ b/runtime/syntax/go.vim
@@ -5,7 +5,8 @@
" go.vim: Vim syntax file for Go.
" Language: Go
" Maintainer: Billie Cleek <bhcleek@gmail.com>
-" Latest Revision: 2023-08-21
+" Latest Revision: 2024-03-17
+" 2024-03-17: - fix goPackageComment highlight (by Vim Project)
" License: BSD-style. See LICENSE file in source repository.
" Repository: https://github.com/fatih/vim-go
@@ -230,21 +231,31 @@ endif
" import
if s:FoldEnable('import')
syn region goImport start='import (' end=')' transparent fold contains=goImport,goImportString,goComment
+ syn match goImport /^import ()/ transparent fold contains=goImport
else
syn region goImport start='import (' end=')' transparent contains=goImport,goImportString,goComment
+ syn match goImport /^import ()/ transparent contains=goImport
endif
" var, const
if s:FoldEnable('varconst')
syn region goVar start='var (' end='^\s*)$' transparent fold
- \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn match goVar /var ()/ transparent fold
+ \ contains=goVar
syn region goConst start='const (' end='^\s*)$' transparent fold
- \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn match goConst /const ()/ transparent fold
+ \ contains=goConst
else
syn region goVar start='var (' end='^\s*)$' transparent
- \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn match goVar /var ()/ transparent
+ \ contains=goVar
syn region goConst start='const (' end='^\s*)$' transparent
- \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ \ contains=ALLBUT,goParen,goBlock,goFunction,goTypeName,goReceiverType,goReceiverVar,goParamName,goParamType,goSimpleParams,goPointerOperator
+ syn match goConst /const ()/ transparent
+ \ contains=goConst
endif
" Single-line var, const, and import.
@@ -521,12 +532,12 @@ if s:HighlightBuildConstraints() || s:FoldEnable('package_comment')
" matched as comments to avoid looking like working build constraints.
" The he, me, and re options let the "package" itself be highlighted by
" the usual rules.
- exe 'syn region goPackageComment start=/\v(\/\/.*\n)+\s*package/'
- \ . ' end=/\v\n\s*package/he=e-7,me=e-7,re=e-7'
+ exe 'syn region goPackageComment start=/\v(\/\/.*\n)+\s*package\s/'
+ \ . ' end=/\v\n\s*package\s/he=e-8,me=e-8,re=e-8'
\ . ' contains=@goCommentGroup,@Spell'
\ . (s:FoldEnable('package_comment') ? ' fold' : '')
- exe 'syn region goPackageComment start=/\v^\s*\/\*.*\n(.*\n)*\s*\*\/\npackage/'
- \ . ' end=/\v\*\/\n\s*package/he=e-7,me=e-7,re=e-7'
+ exe 'syn region goPackageComment start=/\v^\s*\/\*.*\n(.*\n)*\s*\*\/\npackage\s/'
+ \ . ' end=/\v\*\/\n\s*package\s/he=e-8,me=e-8,re=e-8'
\ . ' contains=@goCommentGroup,@Spell'
\ . (s:FoldEnable('package_comment') ? ' fold' : '')
hi def link goPackageComment Comment