Skip to content

Commit b349fee

Browse files
committed
Merge pull request #12308 from kballard/vim-nested-comments
vim: Tweak how comment nesting works Reviewed-by: brson
2 parents 999d55d + bc35eb7 commit b349fee

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/etc/vim/syntax/rust.vim

+6-5
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,12 @@ syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[
163163
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
164164
syn match rustCharacter /'\([^'\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial,rustSpecialError
165165

166-
syn cluster rustComment contains=rustCommentLine,rustCommentLineDoc,rustCommentBlock,rustCommentBlockDoc
167-
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
168-
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
169-
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend
170-
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend
166+
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
167+
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
168+
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell
169+
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell
170+
syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent
171+
syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent
171172
" FIXME: this is a really ugly and not fully correct implementation. Most
172173
" importantly, a case like ``/* */*`` should have the final ``*`` not being in
173174
" a comment, but in practice at present it leaves comments open two levels

0 commit comments

Comments
 (0)