diff options
Diffstat (limited to 'nixvim/plugins/lsp')
| -rw-r--r-- | nixvim/plugins/lsp/default.nix | 20 | ||||
| -rw-r--r-- | nixvim/plugins/lsp/keymaps.nix | 16 | ||||
| -rw-r--r-- | nixvim/plugins/lsp/servers.nix | 82 |
3 files changed, 118 insertions, 0 deletions
diff --git a/nixvim/plugins/lsp/default.nix b/nixvim/plugins/lsp/default.nix new file mode 100644 index 0000000..3d5de1b --- /dev/null +++ b/nixvim/plugins/lsp/default.nix @@ -0,0 +1,20 @@ +{ + imports = [ + ./keymaps.nix + ./servers.nix + ]; + + plugins.lsp = { + enable = true; + + capabilities = '' + capabilities = vim.tbl_deep_extend( + "force", + vim.lsp.protocol.make_client_capabilities(), + require("cmp_nvim_lsp").default_capabilities(), + -- for nil_ls + { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } } + ) + ''; + }; +} diff --git a/nixvim/plugins/lsp/keymaps.nix b/nixvim/plugins/lsp/keymaps.nix new file mode 100644 index 0000000..ee67ab8 --- /dev/null +++ b/nixvim/plugins/lsp/keymaps.nix @@ -0,0 +1,16 @@ +{ + plugins.lsp.keymaps = { + silent = true; + + diagnostic = { + "<leader>e" = "open_float"; + "[d" = "goto_prev"; + "]d" = "goto_next"; + "<leader>u" = "setloclist"; + }; + + lspBuf = { + "<leader>ca" = "code_action"; + }; + }; +} diff --git a/nixvim/plugins/lsp/servers.nix b/nixvim/plugins/lsp/servers.nix new file mode 100644 index 0000000..6334939 --- /dev/null +++ b/nixvim/plugins/lsp/servers.nix @@ -0,0 +1,82 @@ +{ pkgs, helpers, ... }: +{ + extraPackages = [ + # bashls + pkgs.shellcheck + pkgs.shfmt + + # nil-ls + pkgs.nixfmt-rfc-style + ]; + + globals = { + # Required for Deno's LSP + markdown_fenced_languages = [ "ts=typescript" ]; + }; + + plugins.lsp.servers = { + astro.enable = true; + bashls.enable = true; + biome.enable = true; + clangd.enable = true; + denols.enable = true; + eslint.enable = true; + + lua-ls = { + enable = true; + settings = { + diagnostics.globals = [ "vim" ]; + runtime.version = "LuaJIT"; + workspace = { + checkThirdParty = false; + library = [ (helpers.mkRaw "vim.env.VIMRUNTIME") ]; + }; + }; + }; + + nil-ls = { + enable = true; + + settings = { + formatting.command = [ "nixfmt" ]; + }; + }; + + nimls.enable = true; + pyright = { + enable = true; + + settings = { + # Use ruff for imports + pyright = { + disableOrganizeImports = true; + }; + python.ignore = [ "*" ]; + }; + }; + + ruff-lsp = { + enable = true; + + # pyright should handle this + onAttach.function = '' + client.server_capabilities.hoverProvider = false + ''; + }; + + rust-analyzer = { + enable = true; + + installCargo = false; + installRustc = false; + + settings = { + check.command = "clippy"; + }; + }; + + tsserver.enable = true; + typos-lsp.enable = true; + typst-lsp.enable = true; + }; +} |
