summaryrefslogtreecommitdiff
path: root/config/plugins/lsp.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-31 08:32:06 -0500
committerseth <[email protected]>2023-12-31 08:32:35 -0500
commitae9136a14ae0b0fe91faad59b23d3a532ca84ed5 (patch)
tree06bee1b9d961b372312bd26310e2b1baa7fbc342 /config/plugins/lsp.nix
parentadd749d0d1597930ae95ee29d10f5f41416b76d7 (diff)
lsp: use more native lsp features over efmnixvim
Diffstat (limited to 'config/plugins/lsp.nix')
-rw-r--r--config/plugins/lsp.nix86
1 files changed, 52 insertions, 34 deletions
diff --git a/config/plugins/lsp.nix b/config/plugins/lsp.nix
index c2648db..0b8e3cd 100644
--- a/config/plugins/lsp.nix
+++ b/config/plugins/lsp.nix
@@ -1,13 +1,15 @@
-{lib, ...}: {
+{
plugins.lsp = {
enable = true;
+ # nil-ls wants dynamicRegistration
capabilities = ''
capabilities = vim.tbl_deep_extend(
- "force",
- require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
- { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } }
- )
+ "force",
+ vim.lsp.protocol.make_client_capabilities(),
+ require("cmp_nvim_lsp").default_capabilities(),
+ { workspace = { didChangeWatchedFiles = { dynamicRegistration = true } } }
+ )
'';
keymaps = {
@@ -17,38 +19,54 @@
"]d" = "goto_next";
"<leader>u" = "setloclist";
};
+
+ lspBuf = {
+ "<leader>ca" = "code_action";
+ };
};
servers = let
- withDefaultOpts = lib.genAttrs [
- "bashls"
- "lua-ls"
- "nil_ls"
- ] (_: {enable = true;});
-
- optionalOpts = {
- enable = true;
- installLanguageServer = false;
- autostart = false;
- };
+ enable = {enable = true;};
- optional = lib.genAttrs [
- "clangd"
- "eslint"
- "pyright"
- "rust-analyzer"
- "tsserver"
- ] (_: optionalOpts);
- in
- withDefaultOpts
- // optional
- // {
- rust-analyzer =
- optionalOpts
- // {
- installRustc = false;
- installCargo = false;
- };
- };
+ optional =
+ enable
+ // {
+ installLanguageServer = false;
+ autostart = false;
+ };
+ in {
+ bashls = enable;
+ clangd = optional;
+ denols = optional;
+ eslint = optional;
+
+ lua-ls = enable;
+
+ nil_ls =
+ enable
+ // {
+ settings.formatting.command = ["alejandra"];
+ };
+
+ pyright = optional;
+ ruff-lsp =
+ optional
+ // {
+ # let pyright handle it
+ onAttach.function = ''
+ client.server_capabilities.hoverProvider = false
+ '';
+ };
+
+ rust-analyzer =
+ optional
+ // {
+ installRustc = false;
+ installCargo = false;
+ settings.check.command = "clippy";
+ };
+
+ tsserver = optional;
+ };
};
}