Mercurial > vim
annotate src/testdir/test_langmap.vim @ 33353:b59205d0567e v9.0.1939
patch 9.0.1939: still a problem when processing LSP RPC requests
Commit: https://github.com/vim/vim/commit/b80ae6cec34639abfb1a7080fb633346a81a5770
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Sep 24 23:38:46 2023 +0200
patch 9.0.1939: still a problem when processing LSP RPC requests
Problem: still a problem when processing LSP RPC requests
Solution: When processing async LSP RPC requests, compare sequence
numbers only in response messages
A LSP request message can be sent to the language server either
synchronously (ch_evalexpr) or asynchronously (ch_sendexpr). In both
cases, when looking for response messages by using the sequence number,
LSP requests messages from the language server with the same sequence
number should not be used. Patch 9.0.1927 fixed this issue for
synchronous requests. This PR fixes the issue for asynchronous requests
and adds additional tests.
closes: #13158
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 24 Sep 2023 23:45:08 +0200 |
parents | 360f286b5869 |
children |
rev | line source |
---|---|
7703
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " tests for 'langmap' |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
17089
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
3 source check.vim |
8e9e9124c7a2
patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents:
17049
diff
changeset
|
4 CheckFeature langmap |
7708
1a595b2a4d5e
commit https://github.com/vim/vim/commit/09e786e7a7fc952f43e3f88ba49ab1ac6ef3b3a3
Christian Brabandt <cb@256bit.org>
parents:
7703
diff
changeset
|
5 |
7703
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Test_langmap() |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 new |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 set langmap=}l,^x,%v |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call setline(1, ['abc']) |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call feedkeys('gg0}^', 'tx') |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call assert_equal('ac', getline(1)) |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 " in Replace mode |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 " need silent! to avoid a delay when entering Insert mode |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call setline(1, ['abcde']) |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 silent! call feedkeys("gg0lR%{z\<Esc>00", 'tx') |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal('a%{ze', getline(1)) |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 " in Select mode |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 " need silent! to avoid a delay when entering Insert mode |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call setline(1, ['abcde']) |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 silent! call feedkeys("gg0}%}\<C-G>}^\<Esc>00", 'tx') |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 call assert_equal('a}^de', getline(1)) |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 |
19170
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
26 " Error cases |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
27 call assert_fails('set langmap=aA,b', 'E357:') |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
28 call assert_fails('set langmap=z;y;y;z', 'E358:') |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
29 |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
30 " Map character > 256 |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
31 enew! |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
32 set langmap=āx,ăl,āx |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
33 call setline(1, ['abcde']) |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
34 call feedkeys('gg2lā', 'tx') |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
35 call assert_equal('abde', getline(1)) |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
36 |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
37 " special characters in langmap |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
38 enew! |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
39 call setline(1, ['Hello World']) |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
40 set langmap=\\;\\,,\\,\\; |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
41 call feedkeys('ggfo,', 'tx') |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
42 call assert_equal(8, col('.')) |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
43 call feedkeys(';', 'tx') |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
44 call assert_equal(5, col('.')) |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
45 set langmap& |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
46 set langmap=\\;\\,;\\,\\; |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
47 call feedkeys('ggfo,', 'tx') |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
48 call assert_equal(8, col('.')) |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
49 call feedkeys(';', 'tx') |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
50 call assert_equal(5, col('.')) |
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
51 |
30944
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
52 set langmap=RL |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
53 let g:counter = 0 |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
54 nnoremap L;L <Cmd>let g:counter += 1<CR> |
30986
360f286b5869
patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents:
30944
diff
changeset
|
55 nnoremap <C-L> <Cmd>throw 'This mapping should not be triggered'<CR> |
30944
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
56 |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
57 " 'langmap' is applied to keys without modifiers when matching a mapping |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
58 call feedkeys('R;R', 'tx') |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
59 call assert_equal(1, g:counter) |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
60 nunmap L;L |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
61 unlet g:counter |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
62 |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
63 delete |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
64 call assert_equal('', getline(1)) |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
65 undo |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
66 call assert_equal('Hello World', getline(1)) |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
67 " 'langmap' does not change Ctrl-R to Ctrl-L for consistency |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
68 call feedkeys("\<*C-R>", 'tx') |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
69 call assert_equal('', getline(1)) |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
70 |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
71 set langmap=6L |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
72 undo |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
73 setlocal bufhidden=hide |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
74 let oldbuf = bufnr() |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
75 enew |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
76 call assert_notequal(oldbuf, bufnr()) |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
77 " 'langmap' does not change Ctrl-6 to Ctrl-L for consistency |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
78 " Ctrl-6 becomes Ctrl-^ after merging the Ctrl modifier |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
79 call feedkeys("\<*C-6>", 'tx') |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
80 call assert_equal(oldbuf, bufnr()) |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
81 setlocal bufhidden& |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
82 |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
83 nunmap <C-L> |
109aa4913cba
patch 9.0.0806: 'langmap' works differently when there are modifiers
Bram Moolenaar <Bram@vim.org>
parents:
21765
diff
changeset
|
84 |
19170
ad40333f2ec0
patch 8.2.0144: some mapping code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
17089
diff
changeset
|
85 set langmap& |
7703
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 quit! |
39251e981d1f
commit https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 endfunc |
21765
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
19170
diff
changeset
|
88 |
08940efa6b4e
patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents:
19170
diff
changeset
|
89 " vim: shiftwidth=2 sts=2 expandtab |