Add luadev for nvim lsp support

This commit is contained in:
ViViDboarder 2022-01-02 22:44:02 -08:00
parent 5a1a907529
commit 27eccf2b51
3 changed files with 44 additions and 4 deletions

4
.luarc.json Normal file
View File

@ -0,0 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"Lua.workspace.checkThirdParty": false
}

View File

@ -197,7 +197,10 @@ return require("packer").startup({
requires = "neovim/nvim-lspconfig",
})
-- Better display of diagnostics
-- Lua dev for vim
use("folke/lua-dev.nvim")
-- Better display of lsp diagnostics
use("folke/trouble.nvim")
-- Generic linter/formatters in diagnostics API

View File

@ -220,12 +220,45 @@ function M.config_null_ls()
end)
end
local function get_luadev_config()
local luadev = utils.try_require("lua-dev")
if luadev ~= nil then
return luadev.setup({
-- add any options here, or leave empty to use the default settings
lspconfig = {
on_attach = default_attach,
settings = {
Lua = {
completion = {
callSnippet = "Disable",
keywordSnippet = "Disable",
},
},
},
},
})
end
return nil
end
function M.config_lsp_intaller()
utils.try_require("nvim-lsp-installer", function(lsp_installer)
lsp_installer.on_server_ready(function(server)
server:setup({
-- Default options
local opts = {
on_attach = default_attach,
})
}
lsp_installer.on_server_ready(function(server)
-- Config luadev opts
if server.name == "sumneko_lua" then
local luadev = get_luadev_config()
if luadev ~= nil then
opts.settings = luadev.settings
print(vim.inspect(opts.settings.Lua))
end
end
server:setup(opts)
end)
end)
end