Fix highlighting for function return types when highlight_function_arguments is enabled #2116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
vim-go does not highlight function return types with brackets correctly when
g:go_highlight_function_arguments = 1
is setted.expected highlight
actual highlight
vim-go does not highlight the returned types of
b
function, which arestring
anderror
.It should be highlighted as
goType
syntax group (green color in this color scheme), but they actually havegoSimpleArguments
syntax group.note: If
let g:go_highlight_function_arguments = 0
, it is highlighted below.configuration to reproduce
test.vim
. Need to replace/path/to/vim-go/
with the actual path.test.go
cause
goSImpleArtuments
syntax matching definition has a problem.It matches a function argument (e.g.
(a int)
,(a int, b bool)
).it specifys
nextgroup=goSimpleArguments
, it means the group repeats itself. Return types with bracktes are concealed by thisnextgroup
definition.I'm not sure why the nextgroup is specified. I think it's unnecessary because I guess go syntax does not allow an argument list after an argument list.
If someone knows the reasons of the nextgroup, please tell me it 🙏