aboutsummaryrefslogtreecommitdiffstats
path: root/lua/nvim_lsp/skeleton.lua
diff options
context:
space:
mode:
authorHirokazu Hata <h.hata.ai.t@gmail.com>2020-01-06 01:33:15 +0900
committerJustin M. Keyes <justinkz@gmail.com>2020-01-05 08:33:15 -0800
commit3062676b5c846174996bfd7ee746b3e5b7176d5b (patch)
treeeffe6e326c6329288dadb905fe7b0e65bb675c1a /lua/nvim_lsp/skeleton.lua
parent[docgen] Update README.md (diff)
downloadnvim-lspconfig-3062676b5c846174996bfd7ee746b3e5b7176d5b.tar
nvim-lspconfig-3062676b5c846174996bfd7ee746b3e5b7176d5b.tar.gz
nvim-lspconfig-3062676b5c846174996bfd7ee746b3e5b7176d5b.tar.bz2
nvim-lspconfig-3062676b5c846174996bfd7ee746b3e5b7176d5b.tar.lz
nvim-lspconfig-3062676b5c846174996bfd7ee746b3e5b7176d5b.tar.xz
nvim-lspconfig-3062676b5c846174996bfd7ee746b3e5b7176d5b.tar.zst
nvim-lspconfig-3062676b5c846174996bfd7ee746b3e5b7176d5b.zip
skeleton.setup(): pass init_options #89
Nvim built-in lsp client can handle `initializeOptions` as init_options. But nvim-lsp can't give init_options to lsp.start_client. Not all language servers implement `workspace/didChangeConfiguration` now .(ex, gopls) If we use those servers, we get 'not yet implement' error message. So if config.settings is empty list, we don't request `workspace/didChangeConfiguration`. For reference, other client impls: - https://github.com/prabirshrestha/vim-lsp/blob/f769a450b2b96d517610f0e69408c2ebd5cb4214/autoload/lsp.vim#L355-L356 https://github.com/autozimu/LanguageClient-neovim/blob/5d0b1528f2e5d524a739277b4a1623bcfc0e8688/src/language_server_protocol.rs#L3059-L3070 - https://github.com/natebosch/vim-lsc/blob/bef6e960731f1a2b8797dfee29a14e5a650013ca/autoload/lsc/server.vim#L128-L143 https://github.com/prabirshrestha/vim-lsp/blob/f769a450b2b96d517610f0e69408c2ebd5cb4214/autoload/lsp.vim#L461-L519
Diffstat (limited to 'lua/nvim_lsp/skeleton.lua')
-rw-r--r--lua/nvim_lsp/skeleton.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/lua/nvim_lsp/skeleton.lua b/lua/nvim_lsp/skeleton.lua
index 6859be69..9c5b78c6 100644
--- a/lua/nvim_lsp/skeleton.lua
+++ b/lua/nvim_lsp/skeleton.lua
@@ -27,6 +27,7 @@ function skeleton.__newindex(t, template_name, template)
local default_config = tbl_extend("keep", template.default_config, {
log_level = lsp.protocol.MessageType.Warning;
settings = {};
+ init_options = {};
callbacks = {};
})
@@ -98,6 +99,9 @@ function skeleton.__newindex(t, template_name, template)
new_config.settings = vim.deepcopy(new_config.settings)
util.tbl_deep_extend(new_config.settings, default_config.settings)
+ new_config.init_options = vim.deepcopy(new_config.init_options)
+ util.tbl_deep_extend(new_config.init_options, default_config.init_options)
+
new_config.capabilities = new_config.capabilities or lsp.protocol.make_client_capabilities()
util.tbl_deep_extend(new_config.capabilities, {
workspace = {
@@ -123,7 +127,7 @@ function skeleton.__newindex(t, template_name, template)
settings = settings;
})
end
- if new_config.settings then
+ if not vim.tbl_isempty(new_config.settings) then
client.workspace_did_change_configuration(new_config.settings)
end
end)