Skip to content

Commit

Permalink
Revert "neovim: Update bundled tree-sitter parsers"
Browse files Browse the repository at this point in the history
This reverts commit 7f4c36c.

neovim was accidentally bumped during the freeze period before release
with breaking changes.
This commit is related to neovim 0.10, so it is reverted for now.
  • Loading branch information
natsukium committed May 21, 2024
1 parent db2ee05 commit 76ef4c7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 40 deletions.
12 changes: 3 additions & 9 deletions pkgs/by-name/ne/neovim-unwrapped/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,7 @@ in {

dontFixCmake = true;

inherit lua;
treesitter-parsers = treesitter-parsers //
{ markdown = treesitter-parsers.markdown // { location = "tree-sitter-markdown"; }; } //
{ markdown-inline = treesitter-parsers.markdown // { language = "markdown_inline"; location = "tree-sitter-markdown-inline"; }; }
;
inherit lua treesitter-parsers;

buildInputs = [
gperf
Expand Down Expand Up @@ -173,13 +169,11 @@ in {
'' + ''
mkdir -p $out/lib/nvim/parser
'' + lib.concatStrings (lib.mapAttrsToList
(language: grammar: ''
(language: src: ''
ln -s \
${tree-sitter.buildGrammar {
inherit (grammar) src;
inherit language src;
version = "neovim-${finalAttrs.version}";
language = grammar.language or language;
location = grammar.location or null;
}}/parser \
$out/lib/nvim/parser/${language}.so
'')
Expand Down
42 changes: 15 additions & 27 deletions pkgs/by-name/ne/neovim-unwrapped/treesitter-parsers.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
{ fetchurl }:

{
c.src = fetchurl {
url = "https://github.com/tree-sitter/tree-sitter-c/archive/v0.21.0.tar.gz";
hash = "sha256:6f0f5d1b71cf8ffd8a37fb638c6022fa1245bd630150b538547d52128ce0ea7e";
c = fetchurl {
url = "https://github.com/tree-sitter/tree-sitter-c/archive/v0.20.2.tar.gz";
hash = "sha256:af66fde03feb0df4faf03750102a0d265b007e5d957057b6b293c13116a70af2";
};
lua.src = fetchurl {
url = "https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/v0.1.0.tar.gz";
hash = "sha256:230cfcbfa74ed1f7b8149e9a1f34c2efc4c589a71fe0f5dc8560622f8020d722";
lua = fetchurl {
url = "https://github.com/MunifTanjim/tree-sitter-lua/archive/v0.0.14.tar.gz";
hash = "sha256:930d0370dc15b66389869355c8e14305b9ba7aafd36edbfdb468c8023395016d";
};
vim.src = fetchurl {
url = "https://github.com/neovim/tree-sitter-vim/archive/v0.4.0.tar.gz";
hash = "sha256:9f856f8b4a10ab43348550fa2d3cb2846ae3d8e60f45887200549c051c66f9d5";
vim = fetchurl {
url = "https://github.com/neovim/tree-sitter-vim/archive/v0.3.0.tar.gz";
hash = "sha256:403acec3efb7cdb18ff3d68640fc823502a4ffcdfbb71cec3f98aa786c21cbe2";
};
vimdoc.src = fetchurl {
url = "https://github.com/neovim/tree-sitter-vimdoc/archive/v2.5.1.tar.gz";
hash = "sha256:063645096504b21603585507c41c6d8718ff3c11b2150c5bfc31e8f3ee9afea3";
vimdoc = fetchurl {
url = "https://github.com/neovim/tree-sitter-vimdoc/archive/v2.0.0.tar.gz";
hash = "sha256:1ff8f4afd3a9599dd4c3ce87c155660b078c1229704d1a254433e33794b8f274";
};
query.src = fetchurl {
url = "https://github.com/tree-sitter-grammars/tree-sitter-query/archive/v0.3.0.tar.gz";
hash = "sha256:f878ff37abcb83250e31a6569e997546f3dbab74dcb26683cb2d613f7568cfc0";
};
python.src = fetchurl {
url = "https://github.com/tree-sitter/tree-sitter-python/archive/v0.21.0.tar.gz";
hash = "sha256:720304a603271fa89e4430a14d6a81a023d6d7d1171b1533e49c0ab44f1e1c13";
};
bash.src = fetchurl {
url = "https://github.com/tree-sitter/tree-sitter-bash/archive/v0.21.0.tar.gz";
hash = "sha256:f0515efda839cfede851adb24ac154227fbc0dfb60c6c11595ecfa9087d43ceb";
};
markdown.src = fetchurl {
url = "https://github.com/MDeiml/tree-sitter-markdown/archive/v0.2.3.tar.gz";
hash = "sha256:4909d6023643f1afc3ab219585d4035b7403f3a17849782ab803c5f73c8a31d5";
query = fetchurl {
url = "https://github.com/nvim-treesitter/tree-sitter-query/archive/v0.1.0.tar.gz";
hash = "sha256:e2b806f80e8bf1c4f4e5a96248393fe6622fc1fc6189d6896d269658f67f914c";
};
}
8 changes: 4 additions & 4 deletions pkgs/by-name/ne/neovim-unwrapped/update-treesitter-parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

parsers = {}
dir = Path(__file__).parent
regex = re.compile(r"^TREESITTER_([A-Z_]+)_(URL|SHA256)\s+(.+)$")
regex = re.compile(r"^set\(TREESITTER_([A-Z_]+)_(URL|SHA256)\s+([^ \)]+)\s*\)\s*$")

src = subprocess.check_output(
[
Expand All @@ -20,8 +20,8 @@
text=True,
).strip()

for line in open(f"{src}/cmake.deps/deps.txt"):
m = regex.fullmatch(line.strip())
for line in open(f"{src}/cmake.deps/CMakeLists.txt"):
m = regex.fullmatch(line)
if m is None:
continue

Expand All @@ -37,7 +37,7 @@
f.write("{ fetchurl }:\n\n{\n")
for lang, src in parsers.items():
f.write(
f""" {lang}.src = fetchurl {{
f""" {lang} = fetchurl {{
url = "{src["URL"]}";
hash = "sha256:{src["SHA256"]}";
}};
Expand Down

0 comments on commit 76ef4c7

Please sign in to comment.