Skip to content

Commit cc3cae5

Browse files
authored
Merge pull request #1431 from skabbio1976/fix/tree-sitter-path
Fix tree-sitter not found after cargo install
2 parents 97ba9cb + 5b0e831 commit cc3cae5

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

helpers.build.psm1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,19 @@ function Install-TreeSitter {
500500
if ($LASTEXITCODE -ne 0) {
501501
throw "Failed to install tree-sitter-cli"
502502
}
503+
504+
# Ensure cargo bin directory is in PATH so tree-sitter can be found
505+
if (!$IsWindows) {
506+
$cargoBin = "$env:HOME/.cargo/bin"
507+
if ($env:PATH -notlike "*$cargoBin*") {
508+
$env:PATH += ":$cargoBin"
509+
}
510+
} else {
511+
$cargoBin = "$env:USERPROFILE\.cargo\bin"
512+
if ($env:PATH -notlike "*$cargoBin*") {
513+
$env:PATH += ";$cargoBin"
514+
}
515+
}
503516
}
504517
}
505518

0 commit comments

Comments
 (0)