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

View file

@ -1,4 +1,5 @@
{ lib { lib
, runCommand
, fetchFromGitHub , fetchFromGitHub
, ... , ...
} @ inputs: } @ inputs:
@ -24,11 +25,13 @@ let
grammars = tree-sitter.withPlugins (g: [ g.tree-sitter-d2 ]); grammars = tree-sitter.withPlugins (g: [ g.tree-sitter-d2 ]);
nvim-treesitter = inputs.nvim-treesitter.withAllGrammars.overrideAttrs (oldAttrs: { 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 = '' postPatch = ''
rm -r parser
mkdir parser
ln -s ${grammars}/d2.so parser/d2.so
ln -s ${extraGrammars.tree-sitter-d2.src}/queries queries/d2 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({ require("nvim-treesitter.configs").setup({
ensure_installed = {}, ensure_installed = {},
sync_install = false, sync_install = false,