From 89b7afd817ffebc4eac5786a2bcbe39e302e42b3 Mon Sep 17 00:00:00 2001 From: LavaDesu Date: Wed, 1 Sep 2021 15:48:11 +0700 Subject: [PATCH] neovim: add csharp treesitter and lsp --- modules/user/neovim.nix | 2 ++ overlays/tree-sitter.nix | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 overlays/tree-sitter.nix diff --git a/modules/user/neovim.nix b/modules/user/neovim.nix index 238d71e..c02f839 100644 --- a/modules/user/neovim.nix +++ b/modules/user/neovim.nix @@ -25,6 +25,7 @@ (nvim-treesitter.withPlugins (p: with p; [ tree-sitter-comment + tree-sitter-c-sharp # tree-sitter-javascript tree-sitter-jsdoc tree-sitter-nix @@ -127,6 +128,7 @@ }; }; "eslint.enable" = true; + "omnisharp.path" = "${pkgs.omnisharp-roslyn}/bin/omnisharp"; "rust-analyzer.lens.enable" = false; "rust-analyzer.inlayHints.enable" = false; "rust-analyzer.serverPath" = pkgs.rust-analyzer + "/bin/rust-analyzer"; diff --git a/overlays/tree-sitter.nix b/overlays/tree-sitter.nix new file mode 100644 index 0000000..7e8f5d6 --- /dev/null +++ b/overlays/tree-sitter.nix @@ -0,0 +1,31 @@ +# experiment! +self: super: +let + lib = super.lib; + stdenv = super.stdenv; +in { + tree-sitter = super.tree-sitter.overrideAttrs(o: { + passthru = o.passthru // { + withPlugins = grammarFn: + let + grammars = grammarFn o.passthru.builtGrammars; + in + super.linkFarm "grammars" + (map + (drv: + let + name = lib.strings.getName drv; + in + { + name = + (lib.strings.replaceStrings ["-"] ["_"] + (lib.strings.removePrefix "tree-sitter-" + (lib.strings.removeSuffix "-grammar" name))) + + stdenv.hostPlatform.extensions.sharedLibrary; + path = "${drv}/parser"; + } + ) + grammars); + }; + }); +}