From d697690e24ae5ea9dc5189de504b03823f7fb0f4 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 26 Nov 2019 19:49:29 -0500 Subject: [PATCH 1/7] vim-patch:8.1.2345: .cjs files are not recognized as Javascript Problem: .cjs files are not recognized as Javascript. Solution: Add the *.cjs pattern. (closes vim/vim#5268) https://github.com/vim/vim/commit/c1faf3dc3879e8a5e486f31445b5a5753dcbc6a3 --- runtime/filetype.vim | 6 +++--- src/nvim/testdir/test_filetype.vim | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 8ce45b6a50..e27d234a96 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2019 Aug 26 +" Last Change: 2019 Nov 26 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -796,8 +796,8 @@ au BufNewFile,BufRead *.java,*.jav setf java " JavaCC au BufNewFile,BufRead *.jj,*.jjt setf javacc -" JavaScript, ECMAScript -au BufNewFile,BufRead *.js,*.javascript,*.es,*.mjs setf javascript +" JavaScript, ECMAScript, ES module script, CommonJS script +au BufNewFile,BufRead *.js,*.javascript,*.es,*.mjs,*.cjs setf javascript " JavaScript with React au BufNewFile,BufRead *.jsx setf javascriptreact diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 4053746c82..e085f58e56 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -223,7 +223,7 @@ let s:filename_checks = { \ 'jam': ['file.jpl', 'file.jpr'], \ 'java': ['file.java', 'file.jav'], \ 'javacc': ['file.jj', 'file.jjt'], - \ 'javascript': ['file.js', 'file.javascript', 'file.es', 'file.mjs'], + \ 'javascript': ['file.js', 'file.javascript', 'file.es', 'file.mjs', 'file.cjs'], \ 'javascriptreact': ['file.jsx'], \ 'jess': ['file.clp'], \ 'jgraph': ['file.jgr'], From f196ab87a1b5a9da1326d4de883ab7e97a0bb1f0 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 26 Nov 2019 20:05:52 -0500 Subject: [PATCH 2/7] vim-patch:8.1.2348: :const cannot be followed by "| endif" Problem: :const cannot be followed by "| endif". Solution: Check following command for :const. (closes vim/vim#5269) Also fix completion after :const. https://github.com/vim/vim/commit/8f76e6b12b958f2779444a92234bbaf3f49eeb99 --- src/nvim/eval.c | 2 +- src/nvim/ex_docmd.c | 2 ++ src/nvim/testdir/test_cmdline.vim | 1 + src/nvim/testdir/test_const.vim | 6 ++++++ src/nvim/testdir/test_let.vim | 4 ++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 9fe92a92cc..5229a81288 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -2872,7 +2872,7 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx) int c; char_u *p; - if (cmdidx == CMD_let) { + if (cmdidx == CMD_let || cmdidx == CMD_const) { xp->xp_context = EXPAND_USER_VARS; if (vim_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#") == NULL) { /* ":let var1 var2 ...": find last space. */ diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index f18ebffa0a..b24bf119b3 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -2126,6 +2126,7 @@ static char_u * do_one_cmd(char_u **cmdlinep, case CMD_browse: case CMD_call: case CMD_confirm: + case CMD_const: case CMD_delfunction: case CMD_djump: case CMD_dlist: @@ -3437,6 +3438,7 @@ const char * set_one_cmd_context( case CMD_syntax: set_context_in_syntax_cmd(xp, arg); break; + case CMD_const: case CMD_let: case CMD_if: case CMD_elseif: diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 635ee7984a..23784b0308 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -159,6 +159,7 @@ func Test_expr_completion() endif for cmd in [ \ 'let a = ', + \ 'const a = ', \ 'if', \ 'elseif', \ 'while', diff --git a/src/nvim/testdir/test_const.vim b/src/nvim/testdir/test_const.vim index 06062c5e58..1d7b0a56b5 100644 --- a/src/nvim/testdir/test_const.vim +++ b/src/nvim/testdir/test_const.vim @@ -176,6 +176,12 @@ func Test_cannot_modify_existing_variable() call assert_fails('const [i2, f2, s2] = [1, 1.1, "vim"]', 'E995:') endfunc +func Test_const_with_condition() + const x = 0 + if 0 | const x = 1 | endif + call assert_equal(0, x) +endfunc + func Test_const_with_index_access() let l = [1, 2, 3] call assert_fails('const l[0] = 4', 'E996:') diff --git a/src/nvim/testdir/test_let.vim b/src/nvim/testdir/test_let.vim index 3c0fefbd25..0b9331ee38 100644 --- a/src/nvim/testdir/test_let.vim +++ b/src/nvim/testdir/test_let.vim @@ -24,6 +24,10 @@ func Test_let() let out = execute('let a {0 == 1 ? "a" : "b"}') let s = "\na #1\nb #2" call assert_equal(s, out) + + let x = 0 + if 0 | let x = 1 | endif + call assert_equal(0, x) endfunc func s:set_arg1(a) abort From 90f2b1360469821dfd0e7e75d0b43859aa27dac1 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 26 Nov 2019 20:40:12 -0500 Subject: [PATCH 3/7] vim-patch:8.1.2349: :lockvar and :unlockvar cannot be followed by "| endif" Problem: :lockvar and :unlockvar cannot be followed by "| endif". Solution: Check for following commands. (closes vim/vim#5269) https://github.com/vim/vim/commit/cc4423ae13d78367a3d0b5756783523d3b3a1d31 --- src/nvim/ex_docmd.c | 2 ++ src/nvim/testdir/test_const.vim | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index b24bf119b3..743286c64a 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -2151,6 +2151,7 @@ static char_u * do_one_cmd(char_u **cmdlinep, case CMD_leftabove: case CMD_let: case CMD_lockmarks: + case CMD_lockvar: case CMD_lua: case CMD_match: case CMD_mzscheme: @@ -2179,6 +2180,7 @@ static char_u * do_one_cmd(char_u **cmdlinep, case CMD_tilde: case CMD_topleft: case CMD_unlet: + case CMD_unlockvar: case CMD_verbose: case CMD_vertical: case CMD_wincmd: diff --git a/src/nvim/testdir/test_const.vim b/src/nvim/testdir/test_const.vim index 1d7b0a56b5..eaf200e9bb 100644 --- a/src/nvim/testdir/test_const.vim +++ b/src/nvim/testdir/test_const.vim @@ -182,6 +182,20 @@ func Test_const_with_condition() call assert_equal(0, x) endfunc +func Test_lockvar() + let x = 'hello' + lockvar x + call assert_fails('let x = "there"', 'E741') + if 0 | unlockvar x | endif + call assert_fails('let x = "there"', 'E741') + unlockvar x + let x = 'there' + + if 0 | lockvar x | endif + let x = 'again' +endfunc + + func Test_const_with_index_access() let l = [1, 2, 3] call assert_fails('const l[0] = 4', 'E996:') From 278a0b8df3a70e46228b4f41786c38bbd2d91756 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 26 Nov 2019 21:54:48 -0500 Subject: [PATCH 4/7] vim-patch:8.1.1252: not all mapping completion is tested Problem: Not all mapping completion is tested. Solution: Add a few more mapping completion tests. https://github.com/vim/vim/commit/1776a28e9c7fd0236927f14e9df807e524b30721 --- src/nvim/testdir/test_cmdline.vim | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 23784b0308..4a9f1ed19a 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -78,19 +78,31 @@ func Test_map_completion() call feedkeys(":map \\"\", 'xt') call assert_equal('"map ', getreg(':')) + map x middle + map ,f commaf map ,g commaf + map left + map x shiftleft call feedkeys(":map ,\\\"\", 'xt') call assert_equal('"map ,f', getreg(':')) call feedkeys(":map ,\\\\"\", 'xt') call assert_equal('"map ,g', getreg(':')) + call feedkeys(":map \\"\", 'xt') + call assert_equal('"map ', getreg(':')) + call feedkeys(":map \\\"\", 'xt') + call assert_equal('"map x', getreg(':')) unmap ,f unmap ,g + unmap + unmap x set cpo-=< cpo-=B cpo-=k map left call feedkeys(":map \\"\", 'xt') call assert_equal('"map ', getreg(':')) + call feedkeys(":map \\"\", 'xt') + call assert_equal('"map " set cpo+=< @@ -113,6 +125,9 @@ func Test_map_completion() call assert_equal('"map ', getreg(':')) unmap " set cpo-=k + + unmap x + set cpo&vim endfunc func Test_match_completion() From 5ee6c3bd715b0e9c933bad77e7f8bea1ac19c1a1 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 26 Nov 2019 22:02:26 -0500 Subject: [PATCH 5/7] vim-patch:8.1.1253: mapping completion test fails Problem: Mapping completion test fails. Solution: Fix expected output. https://github.com/vim/vim/commit/92b9e60cb5775ebe8949b4e112feb9f8565441e0 --- src/nvim/testdir/test_cmdline.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 4a9f1ed19a..e76817630b 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -91,7 +91,7 @@ func Test_map_completion() call feedkeys(":map \\"\", 'xt') call assert_equal('"map ', getreg(':')) call feedkeys(":map \\\"\", 'xt') - call assert_equal('"map x', getreg(':')) + call assert_equal("\"map \", getreg(':')) unmap ,f unmap ,g unmap @@ -102,7 +102,7 @@ func Test_map_completion() call feedkeys(":map \\"\", 'xt') call assert_equal('"map ', getreg(':')) call feedkeys(":map \\"\", 'xt') - call assert_equal('"map ", getreg(':')) unmap " set cpo+=< From 006beb73c7734247b4d5d1f25afc18dac28af702 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 26 Nov 2019 22:06:31 -0500 Subject: [PATCH 6/7] vim-patch:8.1.1254: mapping completion contains dead code Problem: Mapping completion contains dead code. Solution: Remove the code. https://github.com/vim/vim/commit/61df0c7996d9acc94267735abc214cb176e63ede --- src/nvim/testdir/test_cmdline.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index e76817630b..fe3eaba817 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -107,9 +107,14 @@ func Test_map_completion() " set cpo+=< map left + exe "set t_k6=\[17~" + call feedkeys(":map \[17~x f6x\", 'xt') call feedkeys(":map \\"\", 'xt') call assert_equal('"map ', getreg(':')) + call feedkeys(":map \[17~\\\"\", 'xt') + " call assert_equal("\"map x", getreg(':')) unmap + call feedkeys(":unmap \[17~x\", 'xt') set cpo-=< set cpo+=B From 585e3ddfc785abfd0022af4f9c84f13e24c41782 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Tue, 26 Nov 2019 22:08:31 -0500 Subject: [PATCH 7/7] vim-patch:8.1.1268: map completion test fails in GUI Problem: Map completion test fails in GUI. Solution: Skip the test that fails. https://github.com/vim/vim/commit/510671a055c2d7a329c88bf133ac302139fd3221 --- src/nvim/testdir/test_cmdline.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index fe3eaba817..56157bebec 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -111,8 +111,10 @@ func Test_map_completion() call feedkeys(":map \[17~x f6x\", 'xt') call feedkeys(":map \\"\", 'xt') call assert_equal('"map ', getreg(':')) - call feedkeys(":map \[17~\\\"\", 'xt') - " call assert_equal("\"map x", getreg(':')) + if !has('gui_running') + call feedkeys(":map \[17~\\\"\", 'xt') + " call assert_equal("\"map x", getreg(':')) + endif unmap call feedkeys(":unmap \[17~x\", 'xt') set cpo-=<