Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tree-sitter: add shell completions #364155

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkgs/development/tools/parsing/tree-sitter/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
, nix-update-script
, runCommand
, which
, installShellFiles
, rustPlatform
, emscripten
, Security
Expand Down Expand Up @@ -116,7 +117,7 @@ rustPlatform.buildRustPackage {
buildInputs =
lib.optionals stdenv.hostPlatform.isDarwin [ Security CoreServices ];
nativeBuildInputs =
[ which ]
[ which installShellFiles ]
++ lib.optionals webUISupport [ emscripten ];

patches = lib.optionals webUISupport [
Expand Down Expand Up @@ -150,6 +151,11 @@ rustPlatform.buildRustPackage {
PREFIX=$out make install
${lib.optionalString (!enableShared) "rm $out/lib/*.so{,.*}"}
${lib.optionalString (!enableStatic) "rm $out/lib/*.a"}
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd tree-sitter \
--bash <($out/bin/tree-sitter complete --shell bash) \
--fish <($out/bin/tree-sitter complete --shell fish) \
--zsh <($out/bin/tree-sitter complete --shell zsh)
'';

# test result: FAILED. 120 passed; 13 failed; 0 ignored; 0 measured; 0 filtered out
Expand Down
Loading