From 74808e9032d6044e067b01ce764677c795dcf26d Mon Sep 17 00:00:00 2001 From: Luca Matei Pintilie Date: Sat, 18 Feb 2023 17:48:16 +0100 Subject: Add more LSP plugins --- .config/nvim/lua/lsp.lua | 89 +++++++++++++++++++++++++++++++++----------- .config/nvim/lua/plugins.lua | 4 +- .config/sway/config | 3 +- 3 files changed, 71 insertions(+), 25 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; + -- }; + -- }); }; }) diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index de3025e..fcd06ee 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -42,7 +42,7 @@ local PKGS = { { url = "https://github.com/editorconfig/editorconfig-vim.git" }; { url = "https://github.com/nathom/filetype.nvim.git" }; { url = "https://github.com/wfxr/minimap.vim.git" }; - { url = "https://github.com/edluffy/hologram.nvim.git" }; + { url = "https://github.com/preservim/nerdcommenter.git" }; -- LSP { url = "https://github.com/neovim/nvim-lspconfig.git" }; @@ -182,8 +182,6 @@ local function init_plugins() -- refer to the configuration section below }) - require('hologram').setup({}) - require("nvim-treesitter.configs").setup({ ensure_installed = { "javascript"; "typescript"; "lua"; "c_sharp"; "jsonc" }; sync_install = false; diff --git a/.config/sway/config b/.config/sway/config index 6e71f05..885e846 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -55,7 +55,8 @@ client.placeholder $color0 $color0 $color5 $color0 $color0 client.background $color7 default_border pixel 8 -xwayland enable +#xwayland enable +xwayland disable # Applications set $term $(which alacritty || which footclient) -- cgit v1.2.3