summaryrefslogtreecommitdiff
path: root/nixvim/plugins/lsp
diff options
context:
space:
mode:
authorseth <[email protected]>2024-07-16 19:04:27 -0400
committerseth <[email protected]>2024-07-16 22:24:21 -0400
commit2e7e1ce219b43bb74f67875200dd4b68758ffd27 (patch)
tree11ca91f55aa47c5b341aaf65f3626c9681a22b07 /nixvim/plugins/lsp
parent255e7c40af44aeedf19a3ca682cfc8a098266e8a (diff)
back to nixvim againnixvim-again
Diffstat (limited to 'nixvim/plugins/lsp')
-rw-r--r--nixvim/plugins/lsp/default.nix20
-rw-r--r--nixvim/plugins/lsp/keymaps.nix16
-rw-r--r--nixvim/plugins/lsp/servers.nix82
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;
+ };
+}