lsp: Treat unrooted paths as relative to the worktree root (#17769)

gopls would send us watch patterns like `**/*.mod` and we'd fall back to
watching `/`.

Release Notes:
- Fix file watching for go projects resorting to watching the fs root.

Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
Piotr Osiewicz 2024-09-12 15:23:27 -04:00 committed by GitHub
parent 4d26f83d23
commit b9b62842f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3499,7 +3499,7 @@ impl LspStore {
.to_owned();
let path = if Path::new(path).components().next().is_none()
{
Arc::from(Path::new("/"))
Arc::from(Path::new(worktree_root_path))
} else {
PathBuf::from(path).into()
};