patch 8.2.0555: Vim9: line continuation is not always needed
Problem: Vim9: line continuation is not always needed.
Solution: Recognize continuation lines automatically in list and dict.
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 4e0dc1b..358d4e8 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -966,6 +966,30 @@
assert_true(caught, 'should have caught an exception')
enddef
+def Test_automatic_line_continuation()
+ let mylist = [
+ 'one',
+ 'two',
+ 'three',
+ ] " comment
+ assert_equal(['one', 'two', 'three'], mylist)
+
+ let mydict = {
+ 'one': 1,
+ 'two': 2,
+ 'three':
+ 3,
+ } " comment
+ assert_equal({'one': 1, 'two': 2, 'three': 3}, mydict)
+ mydict = #{
+ one: 1, " comment
+ two:
+ 2,
+ three: 3 " comment
+ }
+ assert_equal(#{one: 1, two: 2, three: 3}, mydict)
+enddef
+
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new