diff options
| author | Kevin Ballard <kevin@sb.org> | 2014-02-15 21:22:13 -0800 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2014-02-24 21:03:05 -0800 |
| commit | bc35eb78e2dab6b7cb3ede9176b0cfcafc4f8362 (patch) | |
| tree | b9e0f59dc3eac1a9947f6663cb86fd1f06d9980b /src/etc/vim/syntax | |
| parent | d98668a55996d656072a4cac7abb1dcbbdf4f48b (diff) | |
| download | rust-bc35eb78e2dab6b7cb3ede9176b0cfcafc4f8362.tar.gz rust-bc35eb78e2dab6b7cb3ede9176b0cfcafc4f8362.zip | |
vim: Tweak how comment nesting works
Don't try to match line comments inside of a comment block. That makes no sense and can highlight differently for people who override their highlights. Similarly, don't match a doc-comment inside of a comment block. It shouldn't be highlighted differently unless it's actually a doc-comment (and nested comments are obviously not doc comments). Fixes #12307.
Diffstat (limited to 'src/etc/vim/syntax')
| -rw-r--r-- | src/etc/vim/syntax/rust.vim | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/etc/vim/syntax/rust.vim b/src/etc/vim/syntax/rust.vim index aac759e3950..5fa93cb3036 100644 --- a/src/etc/vim/syntax/rust.vim +++ b/src/etc/vim/syntax/rust.vim @@ -178,11 +178,12 @@ syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[ syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" syn match rustCharacter /'\([^'\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial,rustSpecialError -syn cluster rustComment contains=rustCommentLine,rustCommentLineDoc,rustCommentBlock,rustCommentBlockDoc -syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell -syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell -syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend -syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend +syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell +syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell +syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell +syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell +syn region rustCommentBlockNest matchgroup=rustCommentBlock start="/\*" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell contained transparent +syn region rustCommentBlockDocNest matchgroup=rustCommentBlockDoc start="/\*" end="\*/" contains=rustTodo,rustCommentBlockDocNest,@Spell contained transparent " FIXME: this is a really ugly and not fully correct implementation. Most " importantly, a case like ``/* */*`` should have the final ``*`` not being in " a comment, but in practice at present it leaves comments open two levels |
