Merge pull request #199081 from figsoda/nvim-treesitter
vimPlugins.nvim-treesitter: follow up to #198606
This commit is contained in:
commit
366a420a08
@ -25,12 +25,12 @@
|
|||||||
};
|
};
|
||||||
bash = buildGrammar {
|
bash = buildGrammar {
|
||||||
language = "bash";
|
language = "bash";
|
||||||
version = "f1a86d3";
|
version = "77cf8a7";
|
||||||
source = fetchFromGitHub {
|
source = fetchFromGitHub {
|
||||||
owner = "tree-sitter";
|
owner = "tree-sitter";
|
||||||
repo = "tree-sitter-bash";
|
repo = "tree-sitter-bash";
|
||||||
rev = "f1a86d3cc5aeeb67e0e52442e893af7f813025b4";
|
rev = "77cf8a7cab8904baf1a721762e012644ac1d4c7b";
|
||||||
hash = "sha256-zzHA+kGw67WFyPVFRWRyKmhAjxp5jkv0K2yhGxNfFM4=";
|
hash = "sha256-UPMJ7iL8Y0NkAHtPDrkTjG1qFwr8rXuGqvsG+LTWqEY=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
beancount = buildGrammar {
|
beancount = buildGrammar {
|
||||||
@ -503,12 +503,12 @@
|
|||||||
};
|
};
|
||||||
help = buildGrammar {
|
help = buildGrammar {
|
||||||
language = "help";
|
language = "help";
|
||||||
version = "8df3266";
|
version = "49cdef5";
|
||||||
source = fetchFromGitHub {
|
source = fetchFromGitHub {
|
||||||
owner = "neovim";
|
owner = "neovim";
|
||||||
repo = "tree-sitter-vimdoc";
|
repo = "tree-sitter-vimdoc";
|
||||||
rev = "8df3266b423d24c9ac3f3b4b9928e65eb1e5e741";
|
rev = "49cdef52ded4a886bf34bc474876b09f9270d48f";
|
||||||
hash = "sha256-t9SHuymK5pYlryWGpORGPYLgPZ3xBx0XH69s5RtRnEI=";
|
hash = "sha256-szNY2yw5i9pgF+MpaEAkP8BgSYEe6nrFW+17sbSZ6Yc=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
hjson = buildGrammar {
|
hjson = buildGrammar {
|
||||||
@ -693,12 +693,12 @@
|
|||||||
};
|
};
|
||||||
lua = buildGrammar {
|
lua = buildGrammar {
|
||||||
language = "lua";
|
language = "lua";
|
||||||
version = "887dfd4";
|
version = "fb30e8c";
|
||||||
source = fetchFromGitHub {
|
source = fetchFromGitHub {
|
||||||
owner = "MunifTanjim";
|
owner = "MunifTanjim";
|
||||||
repo = "tree-sitter-lua";
|
repo = "tree-sitter-lua";
|
||||||
rev = "887dfd4e83c469300c279314ff1619b1d0b85b91";
|
rev = "fb30e8cb605e2ebd6c643e6981325a63fbbde320";
|
||||||
hash = "sha256-5i+UN6Es+K7KDD1qz3ZrVn8IfGdTswcISUyV2sGtY9M=";
|
hash = "sha256-gT2WHH3rkFzb6iER0ryVU7bqVbh36RbTI9HSWMh3DsI=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
m68k = buildGrammar {
|
m68k = buildGrammar {
|
||||||
@ -731,7 +731,6 @@
|
|||||||
hash = "sha256-gKbjAcY/x9sIxiG7edolAQp2JWrx78mEGeCpayxFOuE=";
|
hash = "sha256-gKbjAcY/x9sIxiG7edolAQp2JWrx78mEGeCpayxFOuE=";
|
||||||
};
|
};
|
||||||
location = "tree-sitter-markdown";
|
location = "tree-sitter-markdown";
|
||||||
|
|
||||||
};
|
};
|
||||||
markdown_inline = buildGrammar {
|
markdown_inline = buildGrammar {
|
||||||
language = "markdown_inline";
|
language = "markdown_inline";
|
||||||
@ -743,7 +742,6 @@
|
|||||||
hash = "sha256-gKbjAcY/x9sIxiG7edolAQp2JWrx78mEGeCpayxFOuE=";
|
hash = "sha256-gKbjAcY/x9sIxiG7edolAQp2JWrx78mEGeCpayxFOuE=";
|
||||||
};
|
};
|
||||||
location = "tree-sitter-markdown-inline";
|
location = "tree-sitter-markdown-inline";
|
||||||
|
|
||||||
};
|
};
|
||||||
menhir = buildGrammar {
|
menhir = buildGrammar {
|
||||||
language = "menhir";
|
language = "menhir";
|
||||||
@ -815,7 +813,6 @@
|
|||||||
hash = "sha256-gTmRBFFCBrA48Yn1MO2mMQPpa6u3uv5McC4BDuMXKuM=";
|
hash = "sha256-gTmRBFFCBrA48Yn1MO2mMQPpa6u3uv5McC4BDuMXKuM=";
|
||||||
};
|
};
|
||||||
location = "ocaml";
|
location = "ocaml";
|
||||||
|
|
||||||
};
|
};
|
||||||
ocaml_interface = buildGrammar {
|
ocaml_interface = buildGrammar {
|
||||||
language = "ocaml_interface";
|
language = "ocaml_interface";
|
||||||
@ -827,7 +824,6 @@
|
|||||||
hash = "sha256-gTmRBFFCBrA48Yn1MO2mMQPpa6u3uv5McC4BDuMXKuM=";
|
hash = "sha256-gTmRBFFCBrA48Yn1MO2mMQPpa6u3uv5McC4BDuMXKuM=";
|
||||||
};
|
};
|
||||||
location = "interface";
|
location = "interface";
|
||||||
|
|
||||||
};
|
};
|
||||||
ocamllex = buildGrammar {
|
ocamllex = buildGrammar {
|
||||||
language = "ocamllex";
|
language = "ocamllex";
|
||||||
@ -1163,14 +1159,14 @@
|
|||||||
};
|
};
|
||||||
swift = buildGrammar {
|
swift = buildGrammar {
|
||||||
language = "swift";
|
language = "swift";
|
||||||
version = "c88b5d7";
|
version = "d7808f0";
|
||||||
source = fetchFromGitHub {
|
source = fetchFromGitHub {
|
||||||
owner = "alex-pinkus";
|
owner = "alex-pinkus";
|
||||||
repo = "tree-sitter-swift";
|
repo = "tree-sitter-swift";
|
||||||
nativeBuildInputs = [ nodejs tree-sitter ];
|
nativeBuildInputs = [ nodejs tree-sitter ];
|
||||||
postFetch = "pushd $out && tree-sitter generate && popd";
|
postFetch = "pushd $out && tree-sitter generate && popd";
|
||||||
rev = "c88b5d73f193f5b0762b1a5f0299a275e6a728fb";
|
rev = "d7808f030a44dc8768948042baa7566949785e2f";
|
||||||
hash = "sha256-OfFMGxL72SPZW4AtHoThhYtjmKWabStLKAB9TxmjMDw=";
|
hash = "sha256-7Gjpf2isOpeOV3ZMTMibK+F4C4v8ywOPin2Wv86s+AM=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
sxhkdrc = buildGrammar {
|
sxhkdrc = buildGrammar {
|
||||||
@ -1245,7 +1241,6 @@
|
|||||||
hash = "sha256-Nx+K7Ic/ePKAXPIMlrRn6zELYE59f/FnnZ/LM5ELaU8=";
|
hash = "sha256-Nx+K7Ic/ePKAXPIMlrRn6zELYE59f/FnnZ/LM5ELaU8=";
|
||||||
};
|
};
|
||||||
location = "tsx";
|
location = "tsx";
|
||||||
|
|
||||||
};
|
};
|
||||||
turtle = buildGrammar {
|
turtle = buildGrammar {
|
||||||
language = "turtle";
|
language = "turtle";
|
||||||
@ -1259,12 +1254,12 @@
|
|||||||
};
|
};
|
||||||
twig = buildGrammar {
|
twig = buildGrammar {
|
||||||
language = "twig";
|
language = "twig";
|
||||||
version = "6a01f20";
|
version = "035f549";
|
||||||
source = fetchFromGitHub {
|
source = fetchFromGitHub {
|
||||||
owner = "gbprod";
|
owner = "gbprod";
|
||||||
repo = "tree-sitter-twig";
|
repo = "tree-sitter-twig";
|
||||||
rev = "6a01f20e73038300d205d370212c361949be3035";
|
rev = "035f549ec8c043e734f04341d7ccdc669bb2ba91";
|
||||||
hash = "sha256-M+57mGl4Sgn0yUGAyxHxE6ShR+E/ki4m8/x/f/KHetA=";
|
hash = "sha256-XSE0E6a9o+WpvmMIXHu0N89VqzaIk9eFHofKAPHtT20=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
typescript = buildGrammar {
|
typescript = buildGrammar {
|
||||||
@ -1277,7 +1272,6 @@
|
|||||||
hash = "sha256-Nx+K7Ic/ePKAXPIMlrRn6zELYE59f/FnnZ/LM5ELaU8=";
|
hash = "sha256-Nx+K7Ic/ePKAXPIMlrRn6zELYE59f/FnnZ/LM5ELaU8=";
|
||||||
};
|
};
|
||||||
location = "typescript";
|
location = "typescript";
|
||||||
|
|
||||||
};
|
};
|
||||||
v = buildGrammar {
|
v = buildGrammar {
|
||||||
language = "v";
|
language = "v";
|
||||||
@ -1289,7 +1283,6 @@
|
|||||||
hash = "sha256-d1NeZixsN9992Q1UC5ZKGN4LNxlsvdL91QW2K8d1J9Y=";
|
hash = "sha256-d1NeZixsN9992Q1UC5ZKGN4LNxlsvdL91QW2K8d1J9Y=";
|
||||||
};
|
};
|
||||||
location = "tree_sitter_v";
|
location = "tree_sitter_v";
|
||||||
|
|
||||||
};
|
};
|
||||||
vala = buildGrammar {
|
vala = buildGrammar {
|
||||||
language = "vala";
|
language = "vala";
|
||||||
|
@ -3,11 +3,31 @@
|
|||||||
self: super:
|
self: super:
|
||||||
|
|
||||||
let
|
let
|
||||||
builtGrammars = callPackage ./generated.nix {
|
generatedGrammars = callPackage ./generated.nix {
|
||||||
buildGrammar = callPackage ../../../../../development/tools/parsing/tree-sitter/grammar.nix { };
|
buildGrammar = callPackage ../../../../../development/tools/parsing/tree-sitter/grammar.nix { };
|
||||||
};
|
};
|
||||||
|
|
||||||
allGrammars = lib.filter lib.isDerivation (lib.attrValues builtGrammars);
|
generatedDerivations = lib.filterAttrs (_: lib.isDerivation) generatedGrammars;
|
||||||
|
|
||||||
|
# add aliases so grammars from `tree-sitter` are overwritten in `withPlugins`
|
||||||
|
# for example, for ocaml_interface, the following aliases will be added
|
||||||
|
# ocaml-interface
|
||||||
|
# tree-sitter-ocaml-interface
|
||||||
|
# tree-sitter-ocaml_interface
|
||||||
|
builtGrammars = generatedGrammars // lib.listToAttrs
|
||||||
|
(lib.concatLists (lib.mapAttrsToList
|
||||||
|
(k: v:
|
||||||
|
let
|
||||||
|
replaced = lib.replaceStrings [ "_" ] [ "-" ] k;
|
||||||
|
in
|
||||||
|
map (lib.flip lib.nameValuePair v)
|
||||||
|
([ ("tree-sitter-${k}") ] ++ lib.optionals (k != replaced) [
|
||||||
|
replaced
|
||||||
|
"tree-sitter-${replaced}"
|
||||||
|
]))
|
||||||
|
generatedDerivations));
|
||||||
|
|
||||||
|
allGrammars = lib.attrValues generatedDerivations;
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [ p.c p.java ... ])
|
# pkgs.vimPlugins.nvim-treesitter.withPlugins (p: [ p.c p.java ... ])
|
||||||
@ -34,5 +54,7 @@ in
|
|||||||
|
|
||||||
withAllGrammars = withPlugins (_: allGrammars);
|
withAllGrammars = withPlugins (_: allGrammars);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
meta.maintainers = with lib.maintainers; [ figsoda ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
from os import getenv
|
from os import environ
|
||||||
from os.path import dirname, join
|
from os.path import dirname, join
|
||||||
|
|
||||||
lockfile = json.load(open(join(getenv("NVIM_TREESITTER"), "lockfile.json")))
|
lockfile = json.load(open(join(environ["NVIM_TREESITTER"], "lockfile.json")))
|
||||||
|
|
||||||
configs = json.loads(
|
configs = json.loads(
|
||||||
subprocess.check_output(
|
subprocess.check_output(
|
||||||
@ -98,8 +98,7 @@ def generate_grammar(item):
|
|||||||
location = info.get("location")
|
location = info.get("location")
|
||||||
if location:
|
if location:
|
||||||
generated += f"""
|
generated += f"""
|
||||||
location = "{location}";
|
location = "{location}";"""
|
||||||
"""
|
|
||||||
|
|
||||||
generated += """
|
generated += """
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user