refactor(lsp): move lua defaults to provider

This commit is contained in:
Matt Leong 2021-11-05 17:22:47 -07:00
parent 16884c1c09
commit a96c4cc23d
3 changed files with 20 additions and 20 deletions

View file

@ -38,26 +38,6 @@ local default_config = {
format = true,
disable_formatters = { 'eslint' }, -- e.g. 'eslint', 'prettier', 'stylua'
},
sumneko_lua = {
opts = {
settings = {
Lua = {
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = {
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
},
maxPreload = 10000,
},
},
},
},
},
tsserver = {
format = false, -- disable formatting all together
},

View file

@ -67,6 +67,8 @@ lsp_installer.on_server_ready(function(server)
opts = vim.tbl_deep_extend('force', opts, require('cosmic.lsp.providers.efm'))
elseif server.name == 'jsonls' then
opts = vim.tbl_deep_extend('force', opts, require('cosmic.lsp.providers.jsonls'))
elseif server.name == 'sumneko_lua' then
opts = vim.tbl_deep_extend('force', opts, require('cosmic.lsp.providers.lua'))
elseif server.name == 'eslint' then
opts = vim.tbl_deep_extend('force', opts, require('cosmic.lsp.providers.eslint'))
end

View file

@ -0,0 +1,18 @@
return {
settings = {
Lua = {
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = {
[vim.fn.expand('$VIMRUNTIME/lua')] = true,
[vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true,
},
maxPreload = 10000,
},
},
},
}