diff --git a/init.lua b/init.lua index 154a6b1..ec39a9b 100644 --- a/init.lua +++ b/init.lua @@ -20,12 +20,4 @@ end vim.opt.rtp:prepend(lazypath) 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 diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index cd19260..22f421d 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,52 +1,26 @@ -return { -- LSP Config should be a standalone function, hence this module - { -- LSP Configuration & Plugins +return { + { "neovim/nvim-lspconfig", dependencies = { - -- Automatically install LSPs and related tools to stdpath for neovim "williamboman/mason.nvim", "williamboman/mason-lspconfig.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 = {} }, }, config = function() - require("mason").setup({ - PATH = "append", - }) - vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), callback = function(event) local map = function(keys, func, desc) - vim.keymap.set( - "n", - keys, - func, - { buffer = event.buf, desc = "LSP: " .. desc } - ) + vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) end map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences") - map( - "gI", - require("telescope.builtin").lsp_implementations, - "[G]oto [I]mplementation" - ) - map( - "D", - require("telescope.builtin").lsp_type_definitions, - "Type [D]efinition" - ) - map( - "gs", - require("telescope.builtin").lsp_document_symbols, - "[G]oto [S]ymbols" - ) - map( - "ws", - require("telescope.builtin").lsp_dynamic_workspace_symbols, - "[W]orkspace [S]ymbols" - ) + map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation") + map("D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition") + map("ds", require("telescope.builtin").lsp_document_symbols, "Document [S]ymbols") + map("ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols") map("rn", vim.lsp.buf.rename, "[R]e[n]ame") map("ca", vim.lsp.buf.code_action, "[C]ode [A]ction") map("K", vim.lsp.buf.hover, "Hover Documentation") @@ -67,32 +41,20 @@ return { -- LSP Config should be a standalone function, hence this module end, }) - local capabilities = vim.lsp.protocol.make_client_capabilities() - local servers = { - lua_ls = { - settings = { Lua = { completion = { callSnippet = "Replace" } } }, - }, - } - require("mason").setup() - local ensure_installed = vim.tbl_keys(servers or {}) - require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) - require("mason-lspconfig").setup({ - handlers = { - function(server_name) - local server = servers[server_name] or {} - server.capabilities = vim.tbl_deep_extend( - "force", - {}, - capabilities, - server.capabilities or {} - ) - require("lspconfig")[server_name].setup(server) - end, + require("mason-lspconfig").setup() + + vim.lsp.config("lua_ls", { + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + }, }, }) end, }, - { "fladson/vim-kitty", ft = "kitty" }, + { "fladson/vim-kitty", ft = "kitty" }, { "scallop-lang/vim-scallop", ft = "scallop" }, }