runtime(cs): Update C# runtime files Commit: https://github.com/vim/vim/commit/96395e15125502e6c29bc93c58d688a2bdc31300 Author: Nick Jensen <nicksp...@gmail.com> Date: Sat Mar 15 09:49:13 2025 +0100
runtime(cs): Update C# runtime files closes: https://github.com/vim/vim/issues/16884 Signed-off-by: Nick Jensen <nicksp...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 81153717d..a44b6f62b 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 9.1. Last change: 2025 Mar 10 +*syntax.txt* For Vim version 9.1. Last change: 2025 Mar 15 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1286,6 +1286,21 @@ doesn't work for you, or you don't edit Progress at all, use this in your startup vimrc: > :let filetype_w = "cweb" +CSHARP *cs.vim* *ft-cs-syntax* + +C# raw string literals may use any number of quote marks to encapsulate the +block, and raw interpolated string literals may use any number of braces to +encapsulate the interpolation, e.g. > + + $$$""""Hello {{{name}}}"""" +< +By default, Vim highlights 3-8 quote marks, and 1-8 interpolation braces. +The maximum numbers of quotes and braces recognized can configured using the +following variables: + + Variable Default ~ + g:cs_raw_string_quote_count 8 + g:cs_raw_string_interpolation_brace_count 8 DART *dart.vim* *ft-dart-syntax* diff --git a/runtime/doc/tags b/runtime/doc/tags index 3bd49d90d..c25effa3a 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -6722,6 +6722,7 @@ creating-menus gui.txt /*creating-menus* credits intro.txt /*credits* crontab options.txt /*crontab* cs-find if_cscop.txt /*cs-find* +cs.vim syntax.txt /*cs.vim* cs7-problem term.txt /*cs7-problem* cscope if_cscop.txt /*cscope* cscope-commands if_cscop.txt /*cscope-commands* @@ -7319,6 +7320,7 @@ ft-context-intro ft_context.txt /*ft-context-intro* ft-context-mappings ft_context.txt /*ft-context-mappings* ft-context-settings ft_context.txt /*ft-context-settings* ft-cpp-syntax syntax.txt /*ft-cpp-syntax* +ft-cs-syntax syntax.txt /*ft-cs-syntax* ft-csh-syntax syntax.txt /*ft-csh-syntax* ft-css-omni insert.txt /*ft-css-omni* ft-csv-syntax syntax.txt /*ft-csv-syntax* diff --git a/runtime/ftplugin/cs.vim b/runtime/ftplugin/cs.vim index ada71315e..d40fe43eb 100644 --- a/runtime/ftplugin/cs.vim +++ b/runtime/ftplugin/cs.vim @@ -2,8 +2,7 @@ " Language: C# " Maintainer: Nick Jensen <nicksp...@gmail.com> " Former Maintainer: Johannes Zellner <johan...@zellner.org> -" Last Change: 2022-11-16 -" 2024 Jan 14 by Vim Project (browsefilter) +" Last Change: 2025-03-14 " License: Vim (see :h license) " Repository: https://github.com/nickspoons/vim-cs @@ -21,8 +20,11 @@ setlocal formatoptions-=t formatoptions+=croql " Set 'comments' to format dashed lists in comments. setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,:// +setlocal commentstring=//\ %s -let b:undo_ftplugin = 'setl com< fo<' +setlocal cinoptions=J1 + +let b:undo_ftplugin = 'setl com< fo< cino<' if exists('loaded_matchit') && !exists('b:match_words') " #if/#endif support included by default diff --git a/runtime/syntax/cs.vim b/runtime/syntax/cs.vim index 104470ac4..3ae6bfca8 100644 --- a/runtime/syntax/cs.vim +++ b/runtime/syntax/cs.vim @@ -3,7 +3,7 @@ " Maintainer: Nick Jensen <nicksp...@gmail.com> " Former Maintainers: Anduin Withers <awith...@anduin.com> " Johannes Zellner <johan...@zellner.org> -" Last Change: 2022-11-16 +" Last Change: 2025-03-14 " Filenames: *.cs " License: Vim (see :h license) " Repository: https://github.com/nickspoons/vim-cs @@ -190,6 +190,18 @@ syn match csUnicodeNumber +\U00\x\{6}+ contained contains=csUnicodeSpecifier di syn match csUnicodeSpecifier +\[uUx]+ contained display syn region csString matchgroup=csQuote start=+"+ end=+"\%(u8\)\=+ end=+$+ extend contains=csSpecialChar,csSpecialError,csUnicodeNumber,@Spell + +for s:i in range(3, get(g:, "cs_raw_string_quote_count", 8)) + exe 'syn region csRawString' .. s:i .. ' matchgroup=csQuote start=+\z("\{' .. s:i .. '}\)+ end=+\z1+ oneline nextgroup=csRawStringError' .. s:i + exe 'syn region csRawString' .. s:i .. ' matchgroup=csQuote start=+\z("\{' .. s:i .. '}\)\s*$+ end=+^\s*\z1+ nextgroup=csRawStringError' .. s:i .. ' contains=csRawStringError' .. s:i + exe 'syn match csRawStringError' .. s:i .. ' /\%("\{' .. s:i .. '}\)\@' .. s:i .. '<="\+/ contained' + exe 'syn match csRawStringError' .. s:i .. ' /\S.\{-}\s*"\{' .. s:i .. '}"\@!/ contained' + + exe 'hi def link csRawString' .. s:i .. ' csString' + exe 'hi def link csRawStringError' .. s:i .. ' Error' +endfor +unlet s:i + syn match csCharacter "'[^']*'" contains=csSpecialChar,csSpecialCharError,csUnicodeNumber display syn match csCharacter "'\''" contains=csSpecialChar display syn match csCharacter "'[^\]'" display @@ -217,11 +229,26 @@ syn match csInterpolationAlignDel +,+ contained display syn match csInterpolationFormatDel +:+ contained display syn region csVerbatimString matchgroup=csQuote start=+@"+ end=+"\%(u8\)\=+ skip=+""+ extend contains=csVerbatimQuote,@Spell + +" Interpolated raw string literals +for s:i in range(1, get(g:, "cs_raw_string_interpolation_brace_count", 8)) + exe 'syn region csInterpolatedRawString' .. s:i .. ' matchgroup=csQuote start=+$\{' .. s:i .. '}\z("""\+\)+ end=+\z1+ extend contains=csInterpolation' .. s:i .. ',csInterpolationDelimiterError' .. s:i .. ',@Spell' + exe 'syn match csInterpolationDelimiterError' .. s:i .. ' "}\{' .. s:i .. '}" contained' + exe 'syn match csInterpolationDelimiterError' .. s:i .. ' "{\{' .. 2 * s:i .. ',}" contained' + exe 'syn match csInterpolationDelimiterError' .. s:i .. ' "}\{' .. 2 * s:i .. ',}" contained' + exe 'syn region csInterpolation' .. s:i .. ' matchgroup=csInterpolationDelimiter start=+\%({\{' .. s:i .. '}\)\@' .. s:i .. '<!{\{' .. s:i .. '}{\@!+ end=+}\@<!}\{' .. s:i .. '}\%(}\{' .. s:i .. '}\)\@!+' .. + \ ' keepend contained contains=@csAll,csBraced,csBracketed,csInterpolationAlign,csInterpolationFormat,csInterpolationDelimiterError' .. s:i + + exe 'hi def link csInterpolationDelimiterError' .. s:i .. ' Error' + exe 'hi def link csInterpolatedRawString' .. s:i .. ' csRawString' +endfor +unlet s:i + syn match csVerbatimQuote +""+ contained syn region csInterVerbString matchgroup=csQuote start=+$@"+ start=+@$"+ end=+"\%(u8\)\=+ skip=+""+ extend contains=csInterpolation,csEscapedInterpolation,csSpecialChar,csSpecialError,csUnicodeNumber,csVerbatimQuote,@Spell -syn cluster csString contains=csString,csInterpolatedString,csVerbatimString,csInterVerbString +syn cluster csString contains=csString,csInterpolatedString,csVerbatimString,csInterVerbString,csRawString syn cluster csLiteral contains=csBoolean,@csNumber,csCharacter,@csString,csNull @@ -282,6 +309,8 @@ hi def link csLogicSymbols Operator hi def link csSpecialError Error hi def link csSpecialCharError Error hi def link csString String +hi def link csRawString csString +hi def link csRawStringError Error hi def link csQuote String hi def link csInterpolatedString String hi def link csVerbatimString String -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1ttNNE-00Bf2I-38%40256bit.org.