diff options
author | TJ DeVries <devries.timothyj@gmail.com> | 2020-11-24 23:24:52 -0500 |
---|---|---|
committer | chentau <tchen1998@gmail.com> | 2021-01-26 17:04:31 -0800 |
commit | 901dd79f6a5ee78a55d726abca868bebff117ca9 (patch) | |
tree | d990a5b443149f3cd030d299fea54cd2d82578f7 /test/functional/viml/completion_spec.lua | |
parent | 4d1fc167a8a14067a848719a1d6c772edce6e11f (diff) | |
download | rneovim-901dd79f6a5ee78a55d726abca868bebff117ca9.tar.gz rneovim-901dd79f6a5ee78a55d726abca868bebff117ca9.tar.bz2 rneovim-901dd79f6a5ee78a55d726abca868bebff117ca9.zip |
feat: add completion to ':lua'
Diffstat (limited to 'test/functional/viml/completion_spec.lua')
-rw-r--r-- | test/functional/viml/completion_spec.lua | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 01fc50289d..d59a1a3306 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -26,6 +26,7 @@ describe('completion', function() [7] = {foreground = Screen.colors.White, background = Screen.colors.Red}, [8] = {reverse = true}, [9] = {bold = true, reverse = true}, + [10] = {foreground = Screen.colors.Grey0, background = Screen.colors.Yellow}, }) end) @@ -895,8 +896,47 @@ describe('completion', function() ]]) end) - describe('from the commandline window', function() + describe('lua completion', function() + it('expands when there is only one match', function() + feed(':lua CURRENT_TESTING_VAR = 1<CR>') + feed(':lua CURRENT_TESTING_<TAB>') + screen:expect{grid=[[ + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + :lua CURRENT_TESTING_VAR^ | + ]]} + end) + it('expands when there is only one match', function() + feed(':lua CURRENT_TESTING_FOO = 1<CR>') + feed(':lua CURRENT_TESTING_BAR = 1<CR>') + feed(':lua CURRENT_TESTING_<TAB>') + screen:expect{ grid = [[ + | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {10:CURRENT_TESTING_BAR}{9: CURRENT_TESTING_FOO }| + :lua CURRENT_TESTING_BAR^ | + ]], unchanged = true } + end) + + it('provides completion from `getcompletion()`', function() + eq({'vim'}, meths.call_function('getcompletion', {'vi', 'lua'})) + eq({'vim.api'}, meths.call_function('getcompletion', {'vim.ap', 'lua'})) + eq({'vim.tbl_filter'}, meths.call_function('getcompletion', {'vim.tbl_fil', 'lua'})) + eq({'print(vim'}, meths.call_function('getcompletion', {'print(vi', 'lua'})) + end) + end) + + describe('from the commandline window', function() it('is cleared after CTRL-C', function () feed('q:') feed('ifoo faa fee f') |