fix: Absolutize path to worktree root in worktree.read_text_file
(#19064)
Closes #19050 Release Notes: - Fixed `worktree.read_text_file` plugin API working incorrectly ([#19050](https://github.com/zed-industries/zed/issues/19050))
This commit is contained in:
parent
ccaf3268f8
commit
518f8cc5b7
1 changed files with 10 additions and 4 deletions
|
@ -7663,10 +7663,16 @@ impl LspAdapterDelegate for LocalLspAdapterDelegate {
|
|||
}
|
||||
|
||||
async fn read_text_file(&self, path: PathBuf) -> Result<String> {
|
||||
if self.worktree.entry_for_path(&path).is_none() {
|
||||
return Err(anyhow!("no such path {path:?}"));
|
||||
};
|
||||
self.fs.load(&path).await
|
||||
let entry = self
|
||||
.worktree
|
||||
.entry_for_path(&path)
|
||||
.with_context(|| format!("no worktree entry for path {path:?}"))?;
|
||||
let abs_path = self
|
||||
.worktree
|
||||
.absolutize(&entry.path)
|
||||
.with_context(|| format!("cannot absolutize path {path:?}"))?;
|
||||
|
||||
self.fs.load(&abs_path).await
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue