Description
Bug: LSP 文件刷新时 Windows 路径格式错误 ( \G:... )
环境: Windows 11 Crush 版本: 最新(2026-06 观察) 项目路径: G:_AIXM\AIXMUnity LSP: codely-unity (Node.js)
症状
LSP 服务端能正常启动(dotnet worker 加载成功、MSBuild SDK 检测通过),但在文件同步阶段立即失败:
WARN client.go:560 Failed to read file for refresh
error="open \G:\_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs:
The filename, directory name, or volume label syntax is incorrect."
path="\G:\_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs"
重启也失败:
ERROR lsp_restart.go:54 Failed to restart LSP client
error="failed to initialize lsp client: initialize request failed: context canceled"
name=codely-unity
根因
client.go:560 在构造 Windows 绝对路径时,往盘符路径前面多加了一个 \ ,产生 \G:... 。
Windows 上 \ 开头表示 UNC 路径( \server\share ),后面不能跟盘符冒号,所以 \G:... 是语法错误。
正确路径应为: G:_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs
怀疑是某处写了 filepath.Join("\", path) 或 "\" + path ,没有判断路径是否已经是绝对路径。
完整日志
ERROR client.go:650 Language server stderr
output="[codely-unity-lsp-server] worker launch via unity-bundled-dotnet:
C:\Program Files\dotnet\dotnet.exe
G:_AIXM\AIXMUnity.codely-cli\extensions\codely-unity-lsp-
server\worker\runtime\release\UnityRoslynWorker.dll"
ERROR client.go:650 Language server stderr
output="[codely-unity-lsp] Using MSBuild from SDK at: C:\Program Files\dotnet\sdk\9.0.314"
WARN client.go:560 Failed to read file for refresh
error="open \G:\_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs:
The filename, directory name, or volume label syntax is incorrect."
path="\G:\_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs"
WARN client.go:222 Error closing client during restart
error="context canceled" name=codely-unity
ERROR lsp_restart.go:54 Failed to restart LSP client
error="failed to initialize lsp client: initialize request failed: context canceled"
name=codely-unity
预期行为
Windows 上带盘符的绝对路径应该直接用 G:... 发送,或用 filepath.Clean() / filepath.Abs() 规范化,不要无条件加
\ 前缀。
临时方案
无。Bug 在 Crush LSP 客户端的 Go 代码里,用户层无法绕过。换盘符、缩短路径都没用,因为 \ 前缀是无条件加的。
Version
crush_0.65.2
Environment
Win11
Description
Bug: LSP 文件刷新时 Windows 路径格式错误 ( \G:... )
环境: Windows 11 Crush 版本: 最新(2026-06 观察) 项目路径: G:_AIXM\AIXMUnity LSP: codely-unity (Node.js)
症状
LSP 服务端能正常启动(dotnet worker 加载成功、MSBuild SDK 检测通过),但在文件同步阶段立即失败:
WARN client.go:560 Failed to read file for refresh
error="open \G:\_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs:
The filename, directory name, or volume label syntax is incorrect."
path="\G:\_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs"
重启也失败:
ERROR lsp_restart.go:54 Failed to restart LSP client
error="failed to initialize lsp client: initialize request failed: context canceled"
name=codely-unity
根因
client.go:560 在构造 Windows 绝对路径时,往盘符路径前面多加了一个 \ ,产生 \G:... 。
Windows 上 \ 开头表示 UNC 路径( \server\share ),后面不能跟盘符冒号,所以 \G:... 是语法错误。
正确路径应为: G:_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs
怀疑是某处写了 filepath.Join("\", path) 或 "\" + path ,没有判断路径是否已经是绝对路径。
完整日志
ERROR client.go:650 Language server stderr
output="[codely-unity-lsp-server] worker launch via unity-bundled-dotnet:
C:\Program Files\dotnet\dotnet.exe
G:_AIXM\AIXMUnity.codely-cli\extensions\codely-unity-lsp-
server\worker\runtime\release\UnityRoslynWorker.dll"
ERROR client.go:650 Language server stderr
output="[codely-unity-lsp] Using MSBuild from SDK at: C:\Program Files\dotnet\sdk\9.0.314"
WARN client.go:560 Failed to read file for refresh
error="open \G:\_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs:
The filename, directory name, or volume label syntax is incorrect."
path="\G:\_AIXM\AIXMUnity\Assets\Scripts\Core\GameManager.cs"
WARN client.go:222 Error closing client during restart
error="context canceled" name=codely-unity
ERROR lsp_restart.go:54 Failed to restart LSP client
error="failed to initialize lsp client: initialize request failed: context canceled"
name=codely-unity
预期行为
Windows 上带盘符的绝对路径应该直接用 G:... 发送,或用 filepath.Clean() / filepath.Abs() 规范化,不要无条件加
\ 前缀。
临时方案
无。Bug 在 Crush LSP 客户端的 Go 代码里,用户层无法绕过。换盘符、缩短路径都没用,因为 \ 前缀是无条件加的。
Version
crush_0.65.2
Environment
Win11