mirror of
https://github.com/Cian-H/my_nvim_config.git
synced 2025-12-22 12:11:58 +00:00
Update for deprecation of nvim-lspconfig framework
This commit is contained in:
8
init.lua
8
init.lua
@@ -20,12 +20,4 @@ end
|
|||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require("lazy").setup("plugins", opts)
|
require("lazy").setup("plugins", opts)
|
||||||
|
|
||||||
-- Next, set up custom LSPs
|
|
||||||
local lspconfig = require("lspconfig")
|
|
||||||
lspconfig.nushell.setup({})
|
|
||||||
lspconfig.prolog_ls.setup({ root_dir = lspconfig.util.root_pattern(".git") })
|
|
||||||
lspconfig.nixd.setup({})
|
|
||||||
lspconfig.mojo.setup({})
|
|
||||||
|
|
||||||
require("nvim-web-devicons").refresh() -- This fixes screwiness with the devicon colors
|
require("nvim-web-devicons").refresh() -- This fixes screwiness with the devicon colors
|
||||||
|
|||||||
@@ -1,52 +1,26 @@
|
|||||||
return { -- LSP Config should be a standalone function, hence this module
|
return {
|
||||||
{ -- LSP Configuration & Plugins
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Automatically install LSPs and related tools to stdpath for neovim
|
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||||
{ "j-hui/fidget.nvim", opts = {} }, -- Useful status updates for LSP.
|
{ "j-hui/fidget.nvim", opts = {} },
|
||||||
{ "folke/neodev.nvim", opts = {} },
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
require("mason").setup({
|
|
||||||
PATH = "append",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
local map = function(keys, func, desc)
|
local map = function(keys, func, desc)
|
||||||
vim.keymap.set(
|
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||||
"n",
|
|
||||||
keys,
|
|
||||||
func,
|
|
||||||
{ buffer = event.buf, desc = "LSP: " .. desc }
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
|
map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
|
||||||
map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||||
map(
|
map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
|
||||||
"gI",
|
map("<leader>D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
|
||||||
require("telescope.builtin").lsp_implementations,
|
map("<leader>ds", require("telescope.builtin").lsp_document_symbols, "Document [S]ymbols")
|
||||||
"[G]oto [I]mplementation"
|
map("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
|
||||||
)
|
|
||||||
map(
|
|
||||||
"<leader>D",
|
|
||||||
require("telescope.builtin").lsp_type_definitions,
|
|
||||||
"Type [D]efinition"
|
|
||||||
)
|
|
||||||
map(
|
|
||||||
"<leader>gs",
|
|
||||||
require("telescope.builtin").lsp_document_symbols,
|
|
||||||
"[G]oto [S]ymbols"
|
|
||||||
)
|
|
||||||
map(
|
|
||||||
"<leader>ws",
|
|
||||||
require("telescope.builtin").lsp_dynamic_workspace_symbols,
|
|
||||||
"[W]orkspace [S]ymbols"
|
|
||||||
)
|
|
||||||
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
map("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||||
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
|
map("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
|
||||||
map("K", vim.lsp.buf.hover, "Hover Documentation")
|
map("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||||
@@ -67,32 +41,20 @@ return { -- LSP Config should be a standalone function, hence this module
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
local servers = {
|
|
||||||
lua_ls = {
|
|
||||||
settings = { Lua = { completion = { callSnippet = "Replace" } } },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
require("mason").setup()
|
require("mason").setup()
|
||||||
local ensure_installed = vim.tbl_keys(servers or {})
|
require("mason-lspconfig").setup()
|
||||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
|
||||||
require("mason-lspconfig").setup({
|
vim.lsp.config("lua_ls", {
|
||||||
handlers = {
|
settings = {
|
||||||
function(server_name)
|
Lua = {
|
||||||
local server = servers[server_name] or {}
|
completion = {
|
||||||
server.capabilities = vim.tbl_deep_extend(
|
callSnippet = "Replace",
|
||||||
"force",
|
},
|
||||||
{},
|
},
|
||||||
capabilities,
|
|
||||||
server.capabilities or {}
|
|
||||||
)
|
|
||||||
require("lspconfig")[server_name].setup(server)
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ "fladson/vim-kitty", ft = "kitty" },
|
{ "fladson/vim-kitty", ft = "kitty" },
|
||||||
{ "scallop-lang/vim-scallop", ft = "scallop" },
|
{ "scallop-lang/vim-scallop", ft = "scallop" },
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user