Fixed errors pertaining to lua/plugins/lsp/init.lua
This commit is contained in:
parent
e39011a95c
commit
a5d37b9675
@ -1,31 +1,31 @@
|
|||||||
{
|
{
|
||||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
||||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
||||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||||
"cmp-path": { "branch": "main", "commit": "c6635aae33a50d6010bf1aa756ac2398a2d54c32" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||||
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||||
"kanagawa.nvim": { "branch": "master", "commit": "cc3b68b08e6a0cb6e6bf9944932940091e49bb83" },
|
"kanagawa.nvim": { "branch": "master", "commit": "709018d5af92d2e5780bfb8a6d36e9cad01a6402" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
"live-preview.nvim": { "branch": "main", "commit": "598672eaf91b38946626677f8e80426e6e7ceccc" },
|
"live-preview.nvim": { "branch": "main", "commit": "598672eaf91b38946626677f8e80426e6e7ceccc" },
|
||||||
"lsp_lines.nvim": { "branch": "main", "commit": "a92c755f182b89ea91bd8a6a2227208026f27b4d" },
|
"lsp_lines.nvim": { "branch": "main", "commit": "a92c755f182b89ea91bd8a6a2227208026f27b4d" },
|
||||||
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
"lspkind-nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "0ea56f91b7f51a37b749c050a5e5dfdd56b302b3" },
|
"lualine.nvim": { "branch": "master", "commit": "1517caa8fff05e4b4999857319d3b0609a7f57fa" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
"neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "2a406cdd8c373ae7fe378a9e062a5424472bd8d8" },
|
"nvim-autopairs": { "branch": "master", "commit": "6522027785b305269fa17088395dfc0f456cedd2" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "059e89495b3ec09395262f16b1ad441a38081d04" },
|
"nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" },
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
|
"nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "4ea9083b6d3dff4ddc6da17c51334c3255b7eba5" },
|
"nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "0e21ee8df6235511c02bab4a5b391d18e165a58d" },
|
"nvim-treesitter": { "branch": "master", "commit": "9df671fda41bc4af91b9f7ea3fa1628ba988a77b" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "698b5f805722254bca3c509591c1806d268b6c2f" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "57dfa947cc88cdf1baa2c7e13ed31edddd8fb1d1" },
|
"nvim-web-devicons": { "branch": "master", "commit": "4c3a5848ee0b09ecdea73adcd2a689190aeb728c" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"schemastore.nvim": { "branch": "main", "commit": "992285058ce208825eb1b9ac82fa6be7d76ffcc1" },
|
"schemastore.nvim": { "branch": "main", "commit": "386bdbf18abb6ca103495c5bdbab65e46f3c361d" },
|
||||||
"spellwarn.nvim": { "branch": "main", "commit": "12734b47b008d912b4925c0bc2c1248eb534409d" },
|
"spellwarn.nvim": { "branch": "main", "commit": "12734b47b008d912b4925c0bc2c1248eb534409d" },
|
||||||
"tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" },
|
"tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }
|
"telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ return {
|
|||||||
require("lsp_lines").setup()
|
require("lsp_lines").setup()
|
||||||
require("spellwarn").setup()
|
require("spellwarn").setup()
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
-- local remaps = require("plugins.lsp.remaps")
|
|
||||||
local icons = require("utils.icons")
|
local icons = require("utils.icons")
|
||||||
|
|
||||||
local presentCmpNvimLsp, cmp_lsp = pcall(require, "cmp_nvim_lsp")
|
local presentCmpNvimLsp, cmp_lsp = pcall(require, "cmp_nvim_lsp")
|
||||||
@ -22,7 +21,7 @@ return {
|
|||||||
vim.lsp.set_log_level("error")
|
vim.lsp.set_log_level("error")
|
||||||
|
|
||||||
local function on_attach(client, bufnr)
|
local function on_attach(client, bufnr)
|
||||||
remaps.set_default_on_buffer(client, bufnr)
|
require("plugins.lsp.remaps").set_default_on_buffer(client, bufnr)
|
||||||
if presentLspSignature then
|
if presentLspSignature then
|
||||||
lsp_signature.on_attach({ floating_window = false, timer_interval = 500 })
|
lsp_signature.on_attach({ floating_window = false, timer_interval = 500 })
|
||||||
end
|
end
|
||||||
@ -39,14 +38,10 @@ return {
|
|||||||
end
|
end
|
||||||
|
|
||||||
local config = {
|
local config = {
|
||||||
virtual_text = false, -- appears after the line
|
virtual_text = false,
|
||||||
virtual_lines = false, -- appears under the line
|
virtual_lines = false,
|
||||||
signs = {
|
signs = { active = signs },
|
||||||
active = signs,
|
flags = { debounce_text_changes = 200 },
|
||||||
},
|
|
||||||
flags = {
|
|
||||||
debounce_text_changes = 200,
|
|
||||||
},
|
|
||||||
update_in_insert = true,
|
update_in_insert = true,
|
||||||
underline = true,
|
underline = true,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
@ -60,36 +55,41 @@ return {
|
|||||||
prefix = "",
|
prefix = "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
lspconfig.util.default_config = vim.tbl_deep_extend("force", lspconfig.util.default_config, config)
|
|
||||||
vim.diagnostic.config(config)
|
vim.diagnostic.config(config)
|
||||||
|
|
||||||
local border = {
|
local border = { border = "shadow" }
|
||||||
border = "shadow",
|
|
||||||
}
|
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.hover, border)
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.hover, border)
|
||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, border)
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, border)
|
||||||
|
|
||||||
local capabilities
|
local capabilities = presentCmpNvimLsp and cmp_lsp.default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
if presentCmpNvimLsp then
|
or vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = cmp_lsp.default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
||||||
else
|
local function load_server(name)
|
||||||
capabilities = vim.lsp.protocol.make_client_capabilities()
|
local ok, mod = pcall(require, "plugins.lsp.servers." .. name)
|
||||||
|
if ok then
|
||||||
|
if type(mod) == "function" then
|
||||||
|
return mod(on_attach)
|
||||||
|
elseif type(mod) == "table" then
|
||||||
|
return mod
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local servers = {
|
local servers = {
|
||||||
bashls = require("plugins.lsp.servers.bashls")(on_attach),
|
bashls = load_server("bashls"),
|
||||||
cssls = require("plugins.lsp.servers.cssls")(on_attach),
|
cssls = load_server("cssls"),
|
||||||
dockerls = {},
|
dockerls = {},
|
||||||
html = {},
|
html = {},
|
||||||
jsonls = {},
|
jsonls = {},
|
||||||
lua_ls = require("plugins.lsp.servers.luals")(on_attach),
|
lua_ls = load_server("luals"),
|
||||||
intelephense = require("plugins.lsp.servers.phpls")(on_attach),
|
intelephense = load_server("phpls"),
|
||||||
pylsp = require("plugins.lsp.servers.pylsp")(on_attach),
|
pylsp = load_server("pylsp"),
|
||||||
rust_analyzer = {},
|
rust_analyzer = {},
|
||||||
tailwindcss = require("plugins.lsp.servers.tailwindcss")(on_attach),
|
tailwindcss = load_server("tailwindcss"),
|
||||||
terraformls = {},
|
terraformls = {},
|
||||||
tflint = {},
|
tflint = {},
|
||||||
ts_ls = require("plugins.lsp.servers.ts_ls")(on_attach),
|
ts_ls = load_server("ts_ls"),
|
||||||
yamlls = {},
|
yamlls = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,22 +109,30 @@ return {
|
|||||||
server_configs[server_name] = server_config
|
server_configs[server_name] = server_config
|
||||||
end
|
end
|
||||||
|
|
||||||
local present_mason, mason = pcall(require, "mason-lspconfig")
|
local present_mason_lspconfig, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||||
if present_mason then
|
local present_mason, mason = pcall(require, "mason")
|
||||||
mason.setup({ ensure_installed = server_names })
|
if present_mason and present_mason_lspconfig then
|
||||||
mason.setup_handlers({
|
mason.setup()
|
||||||
function(server)
|
mason_lspconfig.setup({
|
||||||
local merged_config = vim.tbl_deep_extend("force", default_lsp_config, server_configs[server] or {})
|
ensure_installed = server_names,
|
||||||
lspconfig[server].setup(merged_config)
|
automatic_installation = true,
|
||||||
if server == "rust_analyzer" then
|
automatic_enable = true,
|
||||||
local present_rust_tools, rust_tools = pcall(require, "rust-tools")
|
|
||||||
if present_rust_tools then
|
|
||||||
rust_tools.setup({ server = merged_config })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
for _, server in ipairs(server_names) do
|
||||||
|
local merged_config = vim.tbl_deep_extend("force", default_lsp_config, server_configs[server] or {})
|
||||||
|
lspconfig[server].setup(merged_config)
|
||||||
|
if server == "rust_analyzer" then
|
||||||
|
local present_rust_tools, rust_tools = pcall(require, "rust-tools")
|
||||||
|
if present_rust_tools then
|
||||||
|
rust_tools.setup({ server = merged_config })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Declare vim as global for linters
|
||||||
|
---@diagnostic disable-next-line: undefined-global
|
||||||
|
_G.vim = vim
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
lua/plugins/lsp/remaps.lua
Normal file
10
lua/plugins/lsp/remaps.lua
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.set_default_on_buffer(client, bufnr)
|
||||||
|
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user