From 5b0e8310d61ef17bbd925bfc8104ea958bdc2556 Mon Sep 17 00:00:00 2001 From: skabbio1976 Date: Fri, 13 Mar 2026 01:58:12 +0100 Subject: [PATCH] Fix tree-sitter not found after cargo install Install-TreeSitter does not add ~/.cargo/bin to $env:PATH after running cargo install, unlike Install-Rust which does. When Rust is already present on the system (so Install-Rust is a no-op) and ~/.cargo/bin is not in the inherited PATH, the tree-sitter binary cannot be found by Export-GrammarBinding. Add the same PATH update logic that Install-Rust uses. Contact: johan.kallio@teamtech.se --- helpers.build.psm1 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/helpers.build.psm1 b/helpers.build.psm1 index d890df612..3181b9565 100644 --- a/helpers.build.psm1 +++ b/helpers.build.psm1 @@ -500,6 +500,19 @@ function Install-TreeSitter { if ($LASTEXITCODE -ne 0) { throw "Failed to install tree-sitter-cli" } + + # Ensure cargo bin directory is in PATH so tree-sitter can be found + if (!$IsWindows) { + $cargoBin = "$env:HOME/.cargo/bin" + if ($env:PATH -notlike "*$cargoBin*") { + $env:PATH += ":$cargoBin" + } + } else { + $cargoBin = "$env:USERPROFILE\.cargo\bin" + if ($env:PATH -notlike "*$cargoBin*") { + $env:PATH += ";$cargoBin" + } + } } }