{ pkgs, ... }: { environment.systemPackages = [ pkgs.nodePackages.eslint pkgs.nodePackages.prettier ]; programs.nixvim = { keymaps = [ { key = "gD"; action = "lua vim.lsp.buf.declaration()"; options = { noremap = true; }; } { key = "gd"; action = "lua vim.lsp.buf.definition()"; options = { noremap = true; }; } { key = "gi"; action = "lua vim.lsp.buf.implementation()"; options = { noremap = true; }; } { key = "gk"; action = "lua vim.lsp.buf.signature_help()"; options = { noremap = true; }; } { key = "K"; action = "lua vim.lsp.buf.hover()"; options = { noremap = true; }; } { key = "wa"; action = "lua vim.lsp.buf.add_workspace_folder()"; options = { noremap = true; }; } { key = "wr"; action = "lua vim.lsp.buf.remove_workspace_folder()"; options = { noremap = true; }; } { key = "wl"; action = "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))"; options = { noremap = true; }; } { key = "D"; action = "lua vim.lsp.buf.type_definition()"; options = { noremap = true; }; } { key = "r"; action = "lua vim.lsp.buf.rename()"; options = { noremap = true; }; } { key = "ca"; action = "lua vim.lsp.buf.code_action()"; options = { noremap = true; }; } { key = "e"; action = "lua vim.diagnostic.open_float()"; options = { noremap = true; }; } { key = "q"; action = "lua vim.diagnostic.setloclist()"; options = { noremap = true; }; } { key = "f"; action = "lua vim.lsp.buf.formatting()"; options = { noremap = true; }; } { key = "gr"; action = "lua vim.lsp.buf.references()"; options = { noremap = true; }; } ]; plugins.lsp = { enable = true; onAttach = '' -- Set capabilities for the LSP client from blink-cmp -- client.config.capabilities = require('blink.cmp').get_lsp_capabilities(client.config.capabilities) local active_clients = vim.lsp.get_active_clients() if client.name == "denols" then for _, client_ in pairs(active_clients) do -- stop tsserver if denols is already active if client_.name == "ts_ls" then client_.stop() end end elseif client.name == "ts_ls" then for _, client_ in pairs(active_clients) do -- prevent tsserver from starting if denols is already active if client_.name == "denols" then client.stop() end end end ''; servers = { ## Needs a package # awk_ls.enable = true; bashls.enable = true; clangd.enable = true; cmake.enable = true; ## Needs a package # css_variables.enable = true; cssls.enable = true; ## Needs a package # cssmodules_ls.enable = true; ## Needs a package # custom_elements_ls.enable = true; denols = { enable = true; rootDir = "require('lspconfig').util.root_pattern('deno.json', 'deno.jsonc')"; }; dockerls.enable = true; # Docker eslint.enable = true; gopls = { # Golang enable = true; autostart = true; }; ## Needs a package # graphql.enable = true; html.enable = true; java_language_server.enable = true; lua_ls = { # Lua enable = true; settings.telemetry.enable = false; }; marksman.enable = true; nil_ls.enable = true; ## Using nil_ls # nixd.enable = true; postgres_lsp.enable = true; pyright.enable = true; rust_analyzer = { enable = true; installRustc = true; installCargo = true; }; sqls.enable = true; ## Needs a package # sqlls.enable = true; stylelint_lsp.enable = true; tailwindcss.enable = true; ts_ls = { enable = true; rootDir = "require('lspconfig').util.root_pattern('package.json')"; settings = { single_file_support = false; }; }; yamlls.enable = true; # YAML }; }; }; }