From b9b62842f8e9ccd70dba5fd3fa2f3e4b0f2aaab3 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:23:27 -0400 Subject: [PATCH] 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 --- crates/project/src/lsp_store.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index 307e86de45..cdf1fa4be4 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -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() };