diff options
| author | Thomas Schmucker <ts@its1.de> | 2026-08-04 07:44:38 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2026-08-04 07:44:38 +0200 |
| commit | d9a854e3d2b81f857cf050217c77168ef9ec750f (patch) | |
| tree | 48ee3374158c9420f87dbca2b5cc18f6d4db4e99 | |
| parent | 1fb810a94816696ad1b6b0ae1fbbf19c31de4695 (diff) | |
| download | dotfiles-d9a854e3d2b81f857cf050217c77168ef9ec750f.tar.gz dotfiles-d9a854e3d2b81f857cf050217c77168ef9ec750f.tar.bz2 dotfiles-d9a854e3d2b81f857cf050217c77168ef9ec750f.zip | |
install-win: Führe bei NPM Post-Install-Skripte bei Bedarf aus
| -rw-r--r-- | bootstrap-win/neovim.ps1 | 17 | ||||
| -rw-r--r-- | neovim-windows-setup.md | 1 |
2 files changed, 14 insertions, 4 deletions
diff --git a/bootstrap-win/neovim.ps1 b/bootstrap-win/neovim.ps1 index a20f291..aa17dcf 100644 --- a/bootstrap-win/neovim.ps1 +++ b/bootstrap-win/neovim.ps1 | |||
| @@ -118,7 +118,7 @@ function Test-BinaryRuns([string]$Binary, [string[]]$VerifyArgs) { | |||
| 118 | } | 118 | } |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | function Install-NpmPackage([string]$Binary, [string]$Package, [string[]]$VerifyArgs = $null) { | 121 | function Install-NpmPackage([string]$Binary, [string]$Package, [string[]]$VerifyArgs = $null, [switch]$AllowScripts) { |
| 122 | if (Test-CommandExists $Binary) { | 122 | if (Test-CommandExists $Binary) { |
| 123 | if ($VerifyArgs -and -not (Test-BinaryRuns $Binary $VerifyArgs)) { | 123 | if ($VerifyArgs -and -not (Test-BinaryRuns $Binary $VerifyArgs)) { |
| 124 | Write-Warn "'$Binary' ist im PATH, laesst sich aber nicht ausfuehren - vermutlich hat der Post-Install-Download von '$Package' nicht geklappt (Proxy/ignore-scripts pruefen). 'npm uninstall -g $Package' und neu installieren." | 124 | Write-Warn "'$Binary' ist im PATH, laesst sich aber nicht ausfuehren - vermutlich hat der Post-Install-Download von '$Package' nicht geklappt (Proxy/ignore-scripts pruefen). 'npm uninstall -g $Package' und neu installieren." |
| @@ -133,8 +133,17 @@ function Install-NpmPackage([string]$Binary, [string]$Package, [string[]]$Verify | |||
| 133 | return | 133 | return |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | Write-Step "npm install -g $Package" | 136 | # -AllowScripts: fuer Pakete wie tree-sitter-cli, deren Post-Install-Skript |
| 137 | npm install -g $Package | Out-Null | 137 | # die eigentliche native Binary von GitHub nachlaedt. Die globale |
| 138 | # ignore-scripts=true in der npmrc wuerde das verhindern; --no-ignore-scripts | ||
| 139 | # hebt das nur fuer diesen einen Aufruf auf, ohne die npmrc anzufassen. | ||
| 140 | $npmArgs = @("install", "-g", $Package) | ||
| 141 | if ($AllowScripts) { | ||
| 142 | $npmArgs += "--no-ignore-scripts" | ||
| 143 | } | ||
| 144 | |||
| 145 | Write-Step "npm $($npmArgs -join ' ')" | ||
| 146 | npm @npmArgs | Out-Null | ||
| 138 | 147 | ||
| 139 | if ($LASTEXITCODE -ne 0) { | 148 | if ($LASTEXITCODE -ne 0) { |
| 140 | Write-Warn "npm install -g $Package fehlgeschlagen." | 149 | Write-Warn "npm install -g $Package fehlgeschlagen." |
| @@ -182,7 +191,7 @@ function Install-Formatters { | |||
| 182 | function Install-Tools { | 191 | function Install-Tools { |
| 183 | Install-WingetPackage -Binary "rg" -Id "BurntSushi.ripgrep.MSVC" | 192 | Install-WingetPackage -Binary "rg" -Id "BurntSushi.ripgrep.MSVC" |
| 184 | Install-WingetPackage -Binary "fd" -Id "sharkdp.fd" | 193 | Install-WingetPackage -Binary "fd" -Id "sharkdp.fd" |
| 185 | Install-NpmPackage -Binary "tree-sitter" -Package "tree-sitter-cli" -VerifyArgs @("--version") | 194 | Install-NpmPackage -Binary "tree-sitter" -Package "tree-sitter-cli" -VerifyArgs @("--version") -AllowScripts |
| 186 | 195 | ||
| 187 | # MSVC (cl.exe) ist bereits vorhanden, kein winget-Paket noetig - Neovim | 196 | # MSVC (cl.exe) ist bereits vorhanden, kein winget-Paket noetig - Neovim |
| 188 | # dafuer aber aus einer "Developer PowerShell for VS" starten. | 197 | # dafuer aber aus einer "Developer PowerShell for VS" starten. |
diff --git a/neovim-windows-setup.md b/neovim-windows-setup.md index 0fbeefe..c2a4df6 100644 --- a/neovim-windows-setup.md +++ b/neovim-windows-setup.md | |||
| @@ -70,6 +70,7 @@ $userPath = [Environment]::GetEnvironmentVariable("PATH", "User") | |||
| 70 | ## 4. Bekannte Stolpersteine | 70 | ## 4. Bekannte Stolpersteine |
| 71 | 71 | ||
| 72 | - **C-Compiler für `nvim-treesitter` (MSVC)**: `cl.exe` findet `nvim-treesitter` automatisch, aber nur wenn `INCLUDE`/`LIB` gesetzt sind – das passiert ausschließlich in einer "Developer PowerShell for VS" bzw. "x64 Native Tools Command Prompt", nicht in einer normalen PowerShell/Windows Terminal-Sitzung. Ohne das schlägt die Parser-Kompilierung mit einer Meldung wie "cannot find `<header>`.h" fehl, obwohl `cl.exe` selbst gefunden wird. Neovim also immer aus dieser Developer-Shell heraus starten. | 72 | - **C-Compiler für `nvim-treesitter` (MSVC)**: `cl.exe` findet `nvim-treesitter` automatisch, aber nur wenn `INCLUDE`/`LIB` gesetzt sind – das passiert ausschließlich in einer "Developer PowerShell for VS" bzw. "x64 Native Tools Command Prompt", nicht in einer normalen PowerShell/Windows Terminal-Sitzung. Ohne das schlägt die Parser-Kompilierung mit einer Meldung wie "cannot find `<header>`.h" fehl, obwohl `cl.exe` selbst gefunden wird. Neovim also immer aus dieser Developer-Shell heraus starten. |
| 73 | - **clangd bei MSVC-Projekten (z. B. mit `compile_commands.json` aus einem `msbuild`-Rebuild)**: gleicher Grund wie oben. Eine generierte `compile_commands.json` enthält nur die projektspezifischen `/I`-Pfade (vcpkg, NuGet-SDKs), nicht die MSVC-STL-/Windows-SDK-Header – die bezieht `clang-cl` (wie `cl.exe`) über `INCLUDE`/`LIB`. Ohne Developer-Shell meldet clangd `<string>`/`<windows.h>` etc. als nicht gefunden, obwohl die Projekt-Header aufgelöst werden. | ||
| 73 | 74 | ||
| 74 | ## 5. Verifizieren | 75 | ## 5. Verifizieren |
| 75 | 76 | ||
