From 1ba70b81d56314a19b6c6836b357d4f785f2a12a Mon Sep 17 00:00:00 2001 From: ray-x Date: Tue, 28 Sep 2021 08:24:22 +1000 Subject: [PATCH] lazyload lua-dev #72 --- lua/navigator/lazyloader.lua | 6 ++++-- lua/navigator/lspclient/clients.lua | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lua/navigator/lazyloader.lua b/lua/navigator/lazyloader.lua index b752f88..b6b136b 100644 --- a/lua/navigator/lazyloader.lua +++ b/lua/navigator/lazyloader.lua @@ -7,8 +7,10 @@ return { if packer_plugins ~= nil then -- packer install local lazy_plugins = { ["nvim-lspconfig"] = "neovim/nvim-lspconfig", - ["guihua.lua"] = "ray-x/guihua.lua" + ["guihua.lua"] = "ray-x/guihua.lua", + ["lua-dev.nvim"] = "folke/lua-dev.nvim" } + if _NgConfigValues.lspinstall == true then lazy_plugins["nvim-lspinstall"] = "kabouzeid/nvim-lspinstall" end @@ -36,7 +38,7 @@ return { local lsp_inst_cfg = configs[server] if lsp_inst_cfg and lsp_inst_cfg.document_config.default_config then lsp_inst_cfg = lsp_inst_cfg.document_config.default_config - vim.tbl_deep_extend('keep', lsp_inst_cfg, cfg) + lsp_inst_cfg = vim.tbl_deep_extend('keep', lsp_inst_cfg, cfg) require'lspconfig'[server].setup(lsp_inst_cfg) end end diff --git a/lua/navigator/lspclient/clients.lua b/lua/navigator/lspclient/clients.lua index 45acde1..3116b7d 100644 --- a/lua/navigator/lspclient/clients.lua +++ b/lua/navigator/lspclient/clients.lua @@ -31,6 +31,24 @@ local on_attach = require("navigator.lspclient.attach").on_attach -- lua setup local library = {} +local luadevcfg = { + library = { + vimruntime = true, -- runtime path + types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others + plugins = {"nvim-treesitter", "plenary.nvim"} + }, + lspconfig = { + -- cmd = {sumneko_binary}, + on_attach = on_attach + } +} + +local luadev = {} +local ok, l = pcall(require, "lua-dev") +if ok and l then + luadev = l.setup(luadevcfg) +end + local path = vim.split(package.path, ";") table.insert(path, "lua/?.lua") @@ -239,6 +257,8 @@ local setups = { } } +setups.sumneko_lua = vim.tbl_deep_extend('force', luadev, setups.sumneko_lua) + local servers = { "angularls", "gopls", "tsserver", "flow", "bashls", "dockerls", "julials", "pylsp", "pyright", "jedi_language_server", "jdtls", "sumneko_lua", "vimls", "html", "jsonls", "solargraph", "cssls",