diff options
Diffstat (limited to '.config/nvim/lua/lsp.lua')
-rw-r--r-- | .config/nvim/lua/lsp.lua | 89 |
1 files changed, 68 insertions, 21 deletions
diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index c228893..0eba3fe 100644 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -22,14 +22,14 @@ cmp.setup({ sources = cmp.config.sources({ { name = "nvim_lsp"; - entry_filter = function(entry, ctx) + entry_filter = function(entry) return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= "Text" end; }; { name = "vsnip"; - entry_filter = function(entry, ctx) + entry_filter = function(entry) return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= "Text" end; @@ -37,7 +37,7 @@ cmp.setup({ }, { { name = "buffer"; - entry_filter = function(entry, ctx) + entry_filter = function(entry) return require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] ~= "Text" end; @@ -79,17 +79,20 @@ cmp.setup({ -- The function below will be called before any actual modifications from lspkind -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) + ---@diagnostic disable-next-line: unused-local before = function(entry, vim_item) return vim_item end; }); }; }) +local lsp_inlayhints = require("lsp-inlayhints") + local on_attach = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") local lsp_signature = require("lsp_signature") lsp_signature.on_attach({ bind = true }, bufnr) - require("lsp-inlayhints").setup() - require("lsp-inlayhints").on_attach(client, bufnr) + lsp_inlayhints.setup() + lsp_inlayhints.on_attach(client, bufnr, false) end vim.api.nvim_create_augroup("LspAttach_inlayhints", {}) @@ -100,7 +103,7 @@ vim.api.nvim_create_autocmd("LspAttach", { local bufnr = args.buf local client = vim.lsp.get_client_by_id(args.data.client_id) - require("lsp-inlayhints").on_attach(client, bufnr) + lsp_inlayhints.on_attach(client, bufnr, false) end; }) @@ -237,26 +240,70 @@ require("lspconfig").cssls.setup({ on_attach = on_attach; }) +require("lspconfig").bashls.setup({ + capabilities = capabilities; + on_attach = on_attach; +}) + +require("lspconfig").clangd.setup({ + capabilities = capabilities; + on_attach = on_attach; +}) + +require("lspconfig").dockerls.setup({ + capabilities = capabilities; + on_attach = on_attach; +}) + +require("lspconfig").eslint.setup({ + capabilities = capabilities; + on_attach = on_attach; +}) + +require("lspconfig").lua_ls.setup({ + capabilities = capabilities; + on_attach = on_attach; + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT"; + }; + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }; + }; + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true); + }; + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { enable = false }; + }; + }; +}) + local null_ls = require("null-ls") null_ls.setup({ sources = { - null_ls.builtins.diagnostics.eslint; - null_ls.builtins.formatting.eslint; --- null_ls.builtins.formatting.lua_format; --- null_ls.builtins.formatting.prettier; + -- null_ls.builtins.diagnostics.eslint; + -- null_ls.builtins.formatting.eslint; + null_ls.builtins.formatting.lua_format; + -- null_ls.builtins.formatting.prettier; null_ls.builtins.formatting.rustfmt; --- null_ls.builtins.code_actions.shellcheck; --- null_ls.builtins.completion.spell; --- null_ls.builtins.diagnostics.tsc; --- null_ls.builtins.formatting.deno_fmt; --- null_ls.builtins.code_actions.gitsigns.with({ --- config = { --- filter_actions = function(title) --- return title:lower():match("blame") == nil -- filter out blame actions --- end; --- }; --- }); + -- null_ls.builtins.code_actions.shellcheck; + -- null_ls.builtins.completion.spell; + -- null_ls.builtins.diagnostics.tsc; + -- null_ls.builtins.formatting.deno_fmt; + -- null_ls.builtins.code_actions.gitsigns.with({ + -- config = { + -- filter_actions = function(title) + -- -- filter out blame actions + -- return title:lower():match("blame") == nil + -- end; + -- }; + -- }); }; }) |