@@ -451,7 +451,7 @@ syntax keyword goPrimitiveTypes any bool byte complex128 complex64 error float32
451
451
452
452
syntax match goFuncType / func\s *(/ contained contains =goFuncTypeParens skipwhite nextgroup =@goType,goFuncTypeMultiReturnType
453
453
454
- syntax region goFuncTypeParens matchgroup =goFuncParens start =' (' end =' )' contained contains =goFuncParam,@goType, goComma,goComment
454
+ syntax region goFuncTypeParens matchgroup =goFuncParens start =' (' end =' )' contained contains =goFuncParam,goComma,goComment
455
455
syntax region goFuncTypeMultiReturnType matchgroup =goFuncMultiReturnParens start =' (' end =' )' contained contains =goNamedReturnValue,goComma,goComment
456
456
457
457
syntax keyword goMapType map contained skipwhite skipempty nextgroup =goMapTypeKeyType
@@ -548,9 +548,9 @@ syntax match goTypeConstraintSymbols /[~|]/ contained
548
548
" goFuncMultiReturn); look into this further and try to remove this.
549
549
syntax match goFuncReturnType / \s *\z s(\@ 1<!\% (\% (interface\| struct\)\s *{\| [^{]\)\+ / contained contains =@goType skipwhite skipempty nextgroup =goFuncBlock
550
550
551
- syntax region goFuncParams matchgroup =goFuncParens start =' (' end =' )' contained contains =goFuncParam,@goType, goComma,goComment skipwhite nextgroup =goFuncReturnType,goFuncMultiReturn,goFuncBlock
551
+ syntax region goFuncParams matchgroup =goFuncParens start =' (' end =' )' contained contains =goFuncParam,goComma,goComment skipwhite nextgroup =goFuncReturnType,goFuncMultiReturn,goFuncBlock
552
552
syntax region goFuncMultiReturn matchgroup =goFuncMultiReturnParens start =' (' end =' )' contained contains =goNamedReturnValue,goComma,goComment skipwhite skipempty nextgroup =goFuncBlock
553
- syntax region goMethodReceiver matchgroup =goReceiverParens start =' (' end =' )' contained contains =goFuncParam,@goType, goComment skipwhite skipempty nextgroup =goFuncName
553
+ syntax region goMethodReceiver matchgroup =goReceiverParens start =' (' end =' )' contained contains =goFuncParam,goComment skipwhite skipempty nextgroup =goFuncName
554
554
555
555
GoFoldFunc syntax region goFuncBlock matchgroup= goFuncBraces start = ' {' end = ' }' contained contains= @g oStatement skipwhite nextgroup= goFuncCallArgs
556
556
@@ -564,22 +564,20 @@ GoFoldFunc syntax region goFuncBlock matchgroup=goFuncBraces start='{' end='}' c
564
564
" ')\@1<=' didn't work for some reason (i.e. when typing a parameter name, it
565
565
" was highlighted as a type).
566
566
"
567
- " TODO: Performance: Figure out how to remove the need for @goType every time
568
- " goFuncParam is used. This would require this regex to have a zero-length
569
- " match when it's just the type.
570
- "
571
567
" goFuncParam: Assume the user is typing a parameter name (i.e. avoid
572
568
" highlighting parameter names as types until proven otherwise).
573
- syntax match goFuncParam / \% (^\| [(,]\)\@ 1<=\s *\z s\% (\% (\K\k *\s *,\% (\s\|\n\) *\) *\% (chan\>\)\@ !\K\k *\)\% (\s *,\?\% (\s\|\n\) *\% #\z e)\|\s\+\z e[^,]\) / contained contains =goComma,goUnderscore skipwhite nextgroup =@goType,goVariadic
574
- " └──────────────────┘ │ └──────────────┘ │└────────────┘ │└────────────────┘ │ │ │ "
575
- " Param must be preceded │ comma/ws/nl │ 'chan' a type, │ comma/ws/nl │ │ │ "
576
- " by start of line, '(', │ │ not param name │ │ │ │ "
577
- " or ',' followed by └────────────────────────────┘ └────────────────────────┘ └───────────┘ "
578
- " whitespace zero or more previous params if this matches, then we otherwise if this "
579
- " (e.g. 'a, b, ' in 'a, b, c') have one or more params, matches, we have "
580
- " then cursor, then close params then type, "
581
- " paren, e.g.: e.g.: "
582
- " (a, b, c, |) (a, b foo) "
569
+ " conditional group allows skipping directly to type, e.g. func(SomeType) "
570
+ " ┌───────────────────────────────────────────────────────────────────────────────────────────────────┐ "
571
+ syntax match goFuncParam / \% (^\| [(,]\)\@ 1<=\s *\z s\% (\% (\% (\K\k *\s *,\% (\s\|\n\) *\) *\% (chan\>\)\@ !\K\k *\)\% (\s *,\?\% (\s\|\n\) *\% #\z e)\|\s\+\z e[^,]\)\)\? / contained contains =goComma,goUnderscore skipwhite nextgroup =@goType,goVariadic
572
+ " └──────────────────┘ │ └──────────────┘ │└────────────┘ │└────────────────┘ │ │ │ "
573
+ " Param must be preceded │ comma/ws/nl │ 'chan' a type, │ comma/ws/nl │ │ │ "
574
+ " by start of line, '(', │ │ not param name │ │ │ │ "
575
+ " or ',' followed by └────────────────────────────┘ └────────────────────────┘ └───────────┘ "
576
+ " whitespace zero or more previous params if this matches, then we otherwise if this "
577
+ " (e.g. 'a, b, ' in 'a, b, c') have one or more params, matches, we have "
578
+ " then cursor, then close params then type, "
579
+ " paren, e.g.: e.g.: "
580
+ " (a, b, c, |) (a, b foo) "
583
581
" The above diagrams can be found in the Monodraw file goFuncParam_Diagrams.monopic
584
582
585
583
" goFuncParam: Assume the user is typing a type (i.e. avoid highlighting custom
@@ -649,7 +647,7 @@ syntax keyword goInterfaceType interface contained skipwhite skipempty nextgroup
649
647
GoFoldInterface syntax region goInterfaceBlock matchgroup= goInterfaceBraces start = ' {' end = ' }' contained contains= @g oType,goTypeConstraintSymbols,goInterfaceMethod,goComment extend
650
648
651
649
syntax match goInterfaceMethod / \K\k *\z e(/ contained skipwhite nextgroup =goInterfaceMethodParams
652
- syntax region goInterfaceMethodParams matchgroup =goInterfaceMethodParens start =' (' end =' )' contained contains =goFuncParam,@goType, goComma,goComment skipwhite nextgroup =@goType,goInterfaceMethodMultiReturn
650
+ syntax region goInterfaceMethodParams matchgroup =goInterfaceMethodParens start =' (' end =' )' contained contains =goFuncParam,goComma,goComment skipwhite nextgroup =@goType,goInterfaceMethodMultiReturn
653
651
syntax region goInterfaceMethodMultiReturn matchgroup =goFuncMultiReturnParens start =' (' end =' )' contained contains =goNamedReturnValue,goComma,goComment
654
652
655
653
hi link goStructType Keyword
0 commit comments