Description
get_project_root() in lsp.rs parses folder.uri.path() / root_uri.path()
directly via PathBuf::from_str, without stripping the leading / that
file:// URIs prepend before a Windows drive letter per RFC 8089.
On Windows, PathBuf::from_str("/C:/Users/...") does not recognize C: as
a drive prefix when preceded by / — it's parsed as RootDir followed by
a literal folder named "C:". .canonicalize() then always fails,
regardless of whether the path contains spaces or non-ASCII characters.
Impact
.asm-lsp.toml project config is never discovered via rootUri/
workspaceFolders on Windows — this affects every standard LSP client,
since file:///C:/... is the normal, spec-compliant way to represent a
Windows absolute path. Only the deprecated rootPath field (a raw OS
path string, not a URI) bypasses the bug, since it skips URI parsing
entirely.
Repro
- Start
asm-lsp with any LSP client on Windows.
- Send
initialize with rootUri: "file:///C:/some/project" (no
rootPath field).
- Observe
WARN [asm_lsp::lsp] Failed to detect project root in the log,
even though C:\some\project\.asm-lsp.toml exists.
Suggested fix
Strip a leading / when the remainder matches ^[A-Za-z]: before
constructing the PathBuf, in both the workspace_folders and root_uri
branches of get_project_root().
Description
get_project_root()inlsp.rsparsesfolder.uri.path()/root_uri.path()directly via
PathBuf::from_str, without stripping the leading/thatfile:// URIs prepend before a Windows drive letter per RFC 8089.
On Windows,
PathBuf::from_str("/C:/Users/...")does not recognizeC:asa drive prefix when preceded by
/— it's parsed asRootDirfollowed bya literal folder named
"C:"..canonicalize()then always fails,regardless of whether the path contains spaces or non-ASCII characters.
Impact
.asm-lsp.tomlproject config is never discovered viarootUri/workspaceFolderson Windows — this affects every standard LSP client,since
file:///C:/...is the normal, spec-compliant way to represent aWindows absolute path. Only the deprecated
rootPathfield (a raw OSpath string, not a URI) bypasses the bug, since it skips URI parsing
entirely.
Repro
asm-lspwith any LSP client on Windows.initializewithrootUri: "file:///C:/some/project"(norootPathfield).WARN [asm_lsp::lsp] Failed to detect project rootin the log,even though
C:\some\project\.asm-lsp.tomlexists.Suggested fix
Strip a leading
/when the remainder matches^[A-Za-z]:beforeconstructing the
PathBuf, in both theworkspace_foldersandroot_uribranches of
get_project_root().