neovimUtils.grammarToPlugin: also move the queries (#321550)
This installs queries from source into the neovim expected folder. Some grammar queries are already in a folder like expected by neovim but others (notably the treesitter official ones) are not so the code deals with both. For instance the koka grammar puts its queries directly in "queries" folder https://github.com/mtoohey31/tree-sitter-koka/tree/main/queries but some others puts it in a folder expected by neovim like https://github.com/tjdevries/tree-sitter-lua/tree/master/queries/lua .
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
, ruby
|
||||
, lua
|
||||
, python3Packages
|
||||
, writeText
|
||||
, wrapNeovimUnstable
|
||||
, runCommand
|
||||
}:
|
||||
@@ -78,7 +77,7 @@ let
|
||||
++ (extraPython3Packages ps)
|
||||
++ (lib.concatMap (f: f ps) pluginPython3Packages));
|
||||
|
||||
luaEnv = neovim-unwrapped.lua.withPackages(extraLuaPackages);
|
||||
luaEnv = neovim-unwrapped.lua.withPackages extraLuaPackages;
|
||||
|
||||
# as expected by packdir
|
||||
packpathDirs.myNeovimPackages = myVimPackage;
|
||||
@@ -101,13 +100,13 @@ let
|
||||
"--prefix" "LUA_CPATH" ";" (neovim-unwrapped.lua.pkgs.luaLib.genLuaCPathAbsStr luaEnv)
|
||||
];
|
||||
|
||||
manifestRc = vimUtils.vimrcContent ({ customRC = ""; }) ;
|
||||
manifestRc = vimUtils.vimrcContent { customRC = ""; };
|
||||
# we call vimrcContent without 'packages' to avoid the init.vim generation
|
||||
neovimRcContent = vimUtils.vimrcContent ({
|
||||
neovimRcContent = vimUtils.vimrcContent {
|
||||
beforePlugins = "";
|
||||
customRC = lib.concatStringsSep "\n" (pluginRC ++ [customRC]);
|
||||
packages = null;
|
||||
});
|
||||
};
|
||||
in
|
||||
|
||||
builtins.removeAttrs args ["plugins"] // {
|
||||
@@ -225,8 +224,25 @@ let
|
||||
} // grammar.meta;
|
||||
}
|
||||
''
|
||||
mkdir -p $out/parser
|
||||
ln -s ${grammar}/parser $out/parser/${name}.so
|
||||
mkdir -p "$out/parser"
|
||||
ln -s "${grammar}/parser" "$out/parser/${name}.so"
|
||||
|
||||
mkdir -p "$out/queries/${name}"
|
||||
if [ -d "${grammar}/queries/${name}" ]; then
|
||||
echo "moving queries from neovim queries dir"
|
||||
for file in "${grammar}/queries/${name}"*; do
|
||||
ln -s "$file" "$out/queries/${name}/$(basename "$file")"
|
||||
done
|
||||
else
|
||||
if [ -d "${grammar}/queries" ]; then
|
||||
echo "moving queries from standard queries dir"
|
||||
for file in "${grammar}/queries/"*; do
|
||||
ln -s "$file" "$out/queries/${name}/$(basename "$file")"
|
||||
done
|
||||
else
|
||||
echo "missing queries for ${name}"
|
||||
fi
|
||||
fi
|
||||
'');
|
||||
|
||||
in
|
||||
|
||||
Reference in New Issue
Block a user