mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
runtime(vim): Update base-syntax, match continued strings and tail comments
Continued strings are currently only matched after operators, in parenthesised expressions and in function call argument lists. closes: #14975 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
c5cb6b2ee4
commit
c29b533cf1
@@ -34,6 +34,10 @@ autocmd BufNewFile * {
|
||||
\ continuing comment
|
||||
\ continuing comment
|
||||
|
||||
var foo = 42 # commment
|
||||
\ continuing comment
|
||||
\ continuing comment
|
||||
|
||||
# :Foo
|
||||
\ arg1
|
||||
#\ comment
|
||||
|
@@ -31,6 +31,10 @@ autocmd BufNewFile * {
|
||||
\ continuing comment
|
||||
\ continuing comment
|
||||
|
||||
let foo = 42 " commment
|
||||
\ continuing comment
|
||||
\ continuing comment
|
||||
|
||||
" :Foo
|
||||
\ arg1
|
||||
"\ comment
|
||||
|
@@ -40,10 +40,17 @@ augroup! \|\"
|
||||
augroup \"\| | autocmd! | augroup END
|
||||
augroup! \"\|
|
||||
|
||||
" FIXME: required comment prefix
|
||||
augroup foo"comment " start bad fold
|
||||
|
||||
augroup foo"comment
|
||||
au!
|
||||
au BufRead * echo "Foo"
|
||||
augroup END"comment
|
||||
|
||||
augroup foo|echo "Foo"
|
||||
augroup END " terminate bad fold
|
||||
au!
|
||||
au BufRead * echo "Foo"
|
||||
augroup END|echo "Foo"
|
||||
|
||||
augroup! foo"comment
|
||||
augroup! foo|echo "Foo"
|
||||
|
||||
|
@@ -124,7 +124,6 @@ s \&{string}&
|
||||
|
||||
" Trailing comment and bar
|
||||
|
||||
" FIXME: trailing comment, no whitespace
|
||||
s" comment
|
||||
s| echo "Foo"
|
||||
|
||||
|
@@ -4,6 +4,15 @@ echo 'It''s a string'
|
||||
echo 'tab: \t, new line: \n, backslash: \\'
|
||||
echo "tab: \t, new line: \n, backslash: \\"
|
||||
|
||||
" string starts immediately after line continuation character - tests a
|
||||
" comment/string distinguishing implementation quirk
|
||||
echo "foo"
|
||||
\"bar"
|
||||
\ "baz"
|
||||
echo 'foo'
|
||||
\'bar'
|
||||
\ 'baz'
|
||||
|
||||
" String escape sequences
|
||||
|
||||
echo "\316 - \31 - \3 - \x1f - \xf - \X1F - \XF - \u02a4 - \U000002a4 - \b - \e - \f - \n - \r - \t - \\ - \" - \<C-W>"
|
||||
@@ -21,6 +30,13 @@ echo "\<*C->>"
|
||||
echo "\<C->>>"
|
||||
echo "\<*C->>>"
|
||||
|
||||
echo ""
|
||||
echo "\""
|
||||
echo "foo\""
|
||||
echo "\"foo"
|
||||
echo "foo\"bar"
|
||||
|
||||
echo ''
|
||||
echo ''''
|
||||
echo '''foo'
|
||||
echo 'foo'''
|
||||
@@ -30,6 +46,7 @@ echo 'foo''bar'
|
||||
" https://github.com/tpope/vim-unimpaired/blob/6d44a6dc2ec34607c41ec78acf81657248580bf1/plugin/unimpaired.vim#L232
|
||||
let cmd = 'put!=repeat(nr2char(10), v:count1)|silent '']+'
|
||||
|
||||
|
||||
" String interpolation
|
||||
|
||||
echo 'Don''t highlight interpolation: {{ {1 + 2} }}'
|
||||
@@ -39,10 +56,61 @@ echo $'Highlight interpolation:\t{{ { $'nested: {{ {1 + 2} }}' } }}'
|
||||
echo $"Highlight interpolation:\t{{ { string({"foo": "bar"}) } }}"
|
||||
echo $"Highlight interpolation:\t{{ { $"nested: {{ {1 + 2} }}" } }}"
|
||||
|
||||
echo $''''
|
||||
echo $'''foo'
|
||||
echo $'foo'''
|
||||
echo $'foo''bar'
|
||||
|
||||
" Continued string
|
||||
|
||||
let s = "
|
||||
"\ comment
|
||||
\ part 1
|
||||
"\ comment
|
||||
\ part 2
|
||||
"\ comment
|
||||
\" " tail comment
|
||||
|
||||
let s = "\"
|
||||
\\" part 1 \"
|
||||
"\ escape sequence
|
||||
\ \"part 2\"
|
||||
\\"" " tail comment
|
||||
|
||||
let s = '
|
||||
"\ comment
|
||||
\ part 1
|
||||
"\ comment
|
||||
\ part 2
|
||||
"\ comment
|
||||
\' " tail comment
|
||||
|
||||
let s = '''
|
||||
\'' part 1 ''
|
||||
"\ escape sequence
|
||||
\ ''part 2''
|
||||
\''' " tail comment
|
||||
|
||||
let s = $"
|
||||
"\ comment
|
||||
\ part 1
|
||||
"\ comment
|
||||
\ part 2
|
||||
"\ comment
|
||||
\" " tail comment
|
||||
|
||||
let s = $'
|
||||
"\ comment
|
||||
\ part 1
|
||||
"\ comment
|
||||
\ part 2
|
||||
"\ comment
|
||||
\' " tail comment
|
||||
|
||||
call strlen("part 1
|
||||
"\ comment
|
||||
\ part 2")
|
||||
|
||||
call append(0, "part 1
|
||||
"\ comment
|
||||
\ part 2")
|
||||
|
||||
|
||||
" Number
|
||||
|
||||
@@ -301,12 +369,17 @@ let foo = foo +
|
||||
\ bar +
|
||||
\ "baz"
|
||||
|
||||
let foo = foo +
|
||||
"\ "comment string"
|
||||
\ bar
|
||||
|
||||
" Function calls
|
||||
|
||||
call Foo(v:true, v:false, v:null)
|
||||
|
||||
|
||||
" Issue #16221 (vimString becomes vimVar when preceded by !)
|
||||
|
||||
let bar = !'g:bar'->exists()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user