diff options
| author | Ranjith Hegde <ranjithshegde@gmail.com> | 2022-08-23 16:03:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-23 07:03:20 -0700 |
| commit | fe7a6f41e59654db6bbc9eb2d084decc54b295e4 (patch) | |
| tree | c7967bb5b649ad7f8f00c697bedc2f60db9e507a /test/lspconfig_spec.lua | |
| parent | Revert "docs: vim.lsp.buf.formatting() is deprecated #2077 (diff) | |
| download | nvim-lspconfig-fe7a6f41e59654db6bbc9eb2d084decc54b295e4.tar nvim-lspconfig-fe7a6f41e59654db6bbc9eb2d084decc54b295e4.tar.gz nvim-lspconfig-fe7a6f41e59654db6bbc9eb2d084decc54b295e4.tar.bz2 nvim-lspconfig-fe7a6f41e59654db6bbc9eb2d084decc54b295e4.tar.lz nvim-lspconfig-fe7a6f41e59654db6bbc9eb2d084decc54b295e4.tar.xz nvim-lspconfig-fe7a6f41e59654db6bbc9eb2d084decc54b295e4.tar.zst nvim-lspconfig-fe7a6f41e59654db6bbc9eb2d084decc54b295e4.zip | |
feat!: 0.7 API update (#1984)
* switch to lua api for autocommands
* switch to nvim_create_user_command
* move to lua plugin initialization
NOTICE: Defining commands in server configurations will be deprecated in
future releases.
See `:help lspconfig.txt` to setup the same in an `on_attach` function.
Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com>
Diffstat (limited to 'test/lspconfig_spec.lua')
| -rw-r--r-- | test/lspconfig_spec.lua | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/test/lspconfig_spec.lua b/test/lspconfig_spec.lua index 89effd47..f98568c1 100644 --- a/test/lspconfig_spec.lua +++ b/test/lspconfig_spec.lua @@ -32,7 +32,7 @@ describe('lspconfig', function() ok(exec_lua [[ local lspconfig = require("lspconfig") - local not_exist_dir = vim.fn.getcwd().."/not/exsts" + local not_exist_dir = vim.fn.getcwd().."/not/exists" return lspconfig.util.path.exists(not_exist_dir) == false ]]) end) @@ -76,7 +76,7 @@ describe('lspconfig', function() ok(exec_lua [[ local lspconfig = require("lspconfig") - local not_exist_dir = vim.fn.getcwd().."/not/exsts" + local not_exist_dir = vim.fn.getcwd().."/not/exists" return not lspconfig.util.path.is_dir(not_exist_dir) ]]) end) @@ -213,7 +213,43 @@ describe('lspconfig', function() ]]) end) end) + + describe('user commands', function() + it('should translate command definition to nvim_create_user_command options', function() + eq( + { + nargs = '*', + complete = 'custom,v:lua.some_global', + }, + exec_lua [[ + local util = require("lspconfig.util") + return util._parse_user_command_options({ + function () end, + "-nargs=* -complete=custom,v:lua.some_global" + }) + ]] + ) + + eq( + { + desc = 'My awesome description.', + nargs = '*', + complete = 'custom,v:lua.another_global', + }, + exec_lua [[ + local util = require("lspconfig.util") + return util._parse_user_command_options({ + function () end, + ["-nargs"] = "*", + "-complete=custom,v:lua.another_global", + description = "My awesome description." + }) + ]] + ) + end) + end) end) + describe('config', function() it('normalizes user, server, and base default configs', function() eq( @@ -283,7 +319,7 @@ describe('lspconfig', function() local _ = lspconfig.sumneko_lua local _ = lspconfig.tsserver lspconfig.rust_analyzer.setup {} - return lspconfig.available_servers() + return require("lspconfig.util").available_servers() ]], { 'rust_analyzer' } ) |
