Breaking change : easen up custom lspconfig setup
before we were using variables/fields to setup custom lspconfig but today I realized that we dont even need that, we can just modify default lspconfigs config
This commit is contained in:
parent
2b55f9bb78
commit
26fc9b5a6c
3 changed files with 6 additions and 17 deletions
|
@ -23,11 +23,6 @@ M.plugins = {
|
|||
override = {},
|
||||
remove = {},
|
||||
user = {},
|
||||
options = {
|
||||
lspconfig = {
|
||||
setup_lspconf = "", -- path of lspconfig file
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- check core.mappings for table structure
|
||||
|
|
|
@ -6,10 +6,13 @@ end
|
|||
|
||||
require("base46").load_highlight "lsp"
|
||||
require "nvchad_ui.lsp"
|
||||
require "plugins.configs.lsp_installer"
|
||||
|
||||
local M = {}
|
||||
local utils = require "core.utils"
|
||||
|
||||
-- export on_attach & capabilities for custom lspconfigs
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
local vim_version = vim.version()
|
||||
|
||||
|
@ -31,9 +34,9 @@ M.on_attach = function(client, bufnr)
|
|||
end
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
capabilities.textDocument.completion.completionItem = {
|
||||
M.capabilities.textDocument.completion.completionItem = {
|
||||
documentationFormat = { "markdown", "plaintext" },
|
||||
snippetSupport = true,
|
||||
preselectSupport = true,
|
||||
|
@ -53,7 +56,7 @@ capabilities.textDocument.completion.completionItem = {
|
|||
|
||||
lspconfig.sumneko_lua.setup {
|
||||
on_attach = M.on_attach,
|
||||
capabilities = capabilities,
|
||||
capabilities = M.capabilities,
|
||||
|
||||
settings = {
|
||||
Lua = {
|
||||
|
@ -72,11 +75,4 @@ lspconfig.sumneko_lua.setup {
|
|||
},
|
||||
}
|
||||
|
||||
-- requires a file containing user's lspconfigs
|
||||
local addlsp_confs = utils.load_config().plugins.options.lspconfig.setup_lspconf
|
||||
|
||||
if #addlsp_confs ~= 0 then
|
||||
require(addlsp_confs).setup_lsp(M.on_attach, capabilities)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -83,7 +83,6 @@ local plugins = {
|
|||
-- lsp stuff
|
||||
|
||||
["williamboman/nvim-lsp-installer"] = {
|
||||
opt = true,
|
||||
cmd = require("core.lazy_load").lsp_cmds,
|
||||
setup = function()
|
||||
require("core.lazy_load").on_file_open "nvim-lsp-installer"
|
||||
|
@ -94,7 +93,6 @@ local plugins = {
|
|||
after = "nvim-lsp-installer",
|
||||
module = "lspconfig",
|
||||
config = function()
|
||||
require "plugins.configs.lsp_installer"
|
||||
require "plugins.configs.lspconfig"
|
||||
end,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue