tree-sitter: let nixpkgs-format reformat the buffer
This commit is contained in:
parent
85e135d302
commit
632c4140e9
@ -407,7 +407,8 @@ let
|
||||
jsonFile = name: val: (formats.json { }).generate name val;
|
||||
|
||||
# implementation of the updater
|
||||
updateImpl = passArgs "updateImpl-with-args" {
|
||||
updateImpl = passArgs "updateImpl-with-args"
|
||||
{
|
||||
binaries = {
|
||||
curl = "${curl}/bin/curl";
|
||||
nix-prefetch-git = "${nix-prefetch-git}/bin/nix-prefetch-git";
|
||||
@ -418,9 +419,10 @@ let
|
||||
ignoredTreeSitterOrgRepos
|
||||
;
|
||||
}
|
||||
(writers.writePython3 "updateImpl" {
|
||||
flakeIgnore = ["E501"];
|
||||
} ./update_impl.py);
|
||||
(writers.writePython3 "updateImpl"
|
||||
{
|
||||
flakeIgnore = [ "E501" ];
|
||||
} ./update_impl.py);
|
||||
|
||||
# Pass the given arguments to the command, in the ARGS environment variable.
|
||||
# The arguments are just a json object that should be available in the script.
|
||||
@ -433,7 +435,7 @@ let
|
||||
lib.concatMapStringsSep "\n" f
|
||||
(lib.mapAttrsToList (k: v: { name = k; } // v) attrs);
|
||||
|
||||
jsonNewlines = lib.concatMapStringsSep "\n" (lib.generators.toJSON {});
|
||||
jsonNewlines = lib.concatMapStringsSep "\n" (lib.generators.toJSON { });
|
||||
|
||||
# Run the given script for each of the attr list.
|
||||
# The attrs are passed to the script as a json value.
|
||||
@ -447,34 +449,34 @@ let
|
||||
outputDir = "${toString ./.}/grammars";
|
||||
|
||||
update-all-grammars = writeShellScript "update-all-grammars.sh" ''
|
||||
set -euo pipefail
|
||||
${updateImpl} fetch-and-check-tree-sitter-repos '{}'
|
||||
echo "writing files to ${outputDir}" 1>&2
|
||||
mkdir -p "${outputDir}"
|
||||
${forEachParallel
|
||||
"repos-to-fetch"
|
||||
(writeShellScript "fetch-repo" ''
|
||||
${updateImpl} fetch-repo "$1"
|
||||
'')
|
||||
(lib.mapAttrsToList
|
||||
(nixRepoAttrName: attrs: attrs // {
|
||||
inherit
|
||||
nixRepoAttrName
|
||||
outputDir;
|
||||
})
|
||||
allGrammars)
|
||||
}
|
||||
${updateImpl} print-all-grammars-nix-file "$(< ${
|
||||
jsonFile "all-grammars.json" {
|
||||
allGrammars =
|
||||
(lib.mapAttrsToList
|
||||
(nixRepoAttrName: attrs: attrs // {
|
||||
inherit nixRepoAttrName;
|
||||
})
|
||||
allGrammars);
|
||||
inherit outputDir;
|
||||
}
|
||||
})"
|
||||
set -euo pipefail
|
||||
${updateImpl} fetch-and-check-tree-sitter-repos '{}'
|
||||
echo "writing files to ${outputDir}" 1>&2
|
||||
mkdir -p "${outputDir}"
|
||||
${forEachParallel
|
||||
"repos-to-fetch"
|
||||
(writeShellScript "fetch-repo" ''
|
||||
${updateImpl} fetch-repo "$1"
|
||||
'')
|
||||
(lib.mapAttrsToList
|
||||
(nixRepoAttrName: attrs: attrs // {
|
||||
inherit
|
||||
nixRepoAttrName
|
||||
outputDir;
|
||||
})
|
||||
allGrammars)
|
||||
}
|
||||
${updateImpl} print-all-grammars-nix-file "$(< ${
|
||||
jsonFile "all-grammars.json" {
|
||||
allGrammars =
|
||||
(lib.mapAttrsToList
|
||||
(nixRepoAttrName: attrs: attrs // {
|
||||
inherit nixRepoAttrName;
|
||||
})
|
||||
allGrammars);
|
||||
inherit outputDir;
|
||||
}
|
||||
})"
|
||||
'';
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user