plugins/syntax: fix tree-sitter parsers

This commit is contained in:
Dmitriy Pleshevskiy 2022-12-13 00:00:47 +03:00
parent 69355e6429
commit 6dd623dd38
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215
3 changed files with 12 additions and 5 deletions

View file

@ -9,6 +9,7 @@
, theme ? { }
, plugins ? { }
, wrapNeovim
, runCommand
, neovim-unwrapped
, tree-sitter
, neovimPlugins
@ -27,7 +28,7 @@ let
};
pluginParams = neovimPlugins // {
inherit tree-sitter fetchFromGitHub;
inherit runCommand tree-sitter fetchFromGitHub;
inherit plugins enableDevIcons enableTabby enableOrgMode;
themeCfg = theme;
lib = myLib;

View file

@ -1,4 +1,5 @@
{ lib
, runCommand
, fetchFromGitHub
, ...
} @ inputs:
@ -24,11 +25,13 @@ let
grammars = tree-sitter.withPlugins (g: [ g.tree-sitter-d2 ]);
nvim-treesitter = inputs.nvim-treesitter.withAllGrammars.overrideAttrs (oldAttrs: {
passthru.dependencies = oldAttrs.passthru.dependencies ++ [
(runCommand "nvim-treesitter-d2-grammar" { } ''
mkdir -p $out/parser
ln -s ${grammars}/d2.so $out/parser/d2.so
'')
];
postPatch = ''
rm -r parser
mkdir parser
ln -s ${grammars}/d2.so parser/d2.so
ln -s ${extraGrammars.tree-sitter-d2.src}/queries queries/d2
'';
});

View file

@ -1,3 +1,6 @@
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.d2 = {}
require("nvim-treesitter.configs").setup({
ensure_installed = {},
sync_install = false,