0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

runtime(vim): Update base-syntax, improve :let-heredoc highlighting

The end marker must appear on line of its own without any trailing
whitespace.

Whitespace is incorrectly allowed before all end markers.  Limiting this
only to heredocs where "trim" was specified, and with the correct
indent, is currently an intractable problem given that contained syntax
groups (in this case :let) cannot be limited to start patterns.

Highlight interpolated expressions when "eval" is specified.

cloess: #15511

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Doug Kearns
2024-08-16 21:07:15 +02:00
committed by Christian Brabandt
parent 8f3f78546f
commit d164f2a521
15 changed files with 280 additions and 12 deletions

View File

@@ -120,7 +120,7 @@ def Foo()
enddef
def Foo()
let x =<< END
var x =<< trim END
endfunction
END
enddef

View File

@@ -193,10 +193,9 @@ function Foo()
endfunction
function Foo()
let x =<< END
let x =<< trim END
endfunction
END
endfunction
function Foo()

View File

@@ -0,0 +1,116 @@
" Vim :let heredoc command
" VIM_TEST_SETUP let g:vimsyn_folding = "h"
" VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
let foo =<< END
line1
line2
END
let foo =<< END
line1
line2
END
let foo =<< trim END
line1
line2
END
let foo =<< trim END
line1
line2
END
" interpolation
let foo =<< eval END
line{1 + 0}
line{1 + 1}
END
let foo =<< eval END
line{1 + 0}
line{1 + 1}
END
let foo =<< trim eval END
line{1 + 0}
line{1 + 1}
END
let foo =<< trim eval END
line{1 + 0}
line{1 + 1}
END
" no interpolation (escaped { and })
let foo =<< eval END
line{{1 + 0}}
line{{1 + 1}}
END
let foo =<< eval END
line{{1 + 0}}
line{{1 + 1}}
END
let foo =<< trim eval END
line{{1 + 0}}
line{{1 + 1}}
END
let foo =<< trim eval END
line{{1 + 0}}
line{{1 + 1}}
END
" no interpolation
let foo =<< END
line{1 + 0}
line{1 + 1}
END
let foo =<< END
line{1 + 0}
line{1 + 1}
END
let foo =<< trim END
line{1 + 0}
line{1 + 1}
END
let foo =<< trim END
line{1 + 0}
line{1 + 1}
END
" end marker must not be followed by whitespace
" assert_equal(foo, ["END "])
let foo =<< END
END
END
" assert_equal(foo, [" END "])
let foo =<< END
END
END
" assert_equal(foo, ["END "])
let foo =<< trim END
END
END
" assert_equal(foo, ["END "])
let foo =<< trim END
END
END