Skip to content

Commit c6f9eb6

Browse files
committed
Fix contract folding by adding skipnl/skipempty
Contract name matching needs to skip newlines and empty lines to properly match the opening brace for folding. Without this, contracts written with the brace on the same line as the name wouldn't fold properly.
1 parent 087eedc commit c6f9eb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

syntax/solidity.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ hi def link yulVarDeclaration Keyword
132132
hi def link yulAssemblyOp Keyword
133133

134134
" Contract
135-
syn match solContract /\<\%(contract\|library\|interface\)\>/ nextgroup=solContractName skipwhite
136-
syn match solContractName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=solContractParent,solContractBody skipwhite
135+
syn match solContract /\<\%(contract\|library\|interface\)\>/ nextgroup=solContractName skipwhite skipnl skipempty
136+
syn match solContractName contained /\<[a-zA-Z_$][0-9a-zA-Z_$]*/ nextgroup=solContractParent,solContractBody skipwhite skipnl skipempty
137137
syn region solContractParent contained start='is' end='{' contains=solContractName,solContractNoise,solContractCommas nextgroup=solContractBody skipwhite skipempty
138138
syn match solContractNoise contained 'is' containedin=solContractParent
139139
syn match solContractCommas contained ','

0 commit comments

Comments
 (0)