Fix prettier errors around Zed's settings.json/keymap.json files

Ports https://github.com/zed-industries/zed/pull/3191 to zed2

Deals with zed-industries/community#2191
Fix Zed starting too many prettier installations in the beginning, and not being able to format the config files.
This commit is contained in:
Kirill Bulatov 2023-10-31 12:26:49 +02:00
parent 88875fd006
commit 84c5494949
3 changed files with 113 additions and 28 deletions

View file

@ -2659,12 +2659,12 @@ impl language2::File for File {
impl language2::LocalFile for File {
fn abs_path(&self, cx: &AppContext) -> PathBuf {
self.worktree
.read(cx)
.as_local()
.unwrap()
.abs_path
.join(&self.path)
let worktree_path = &self.worktree.read(cx).as_local().unwrap().abs_path;
if self.path.as_ref() == Path::new("") {
worktree_path.to_path_buf()
} else {
worktree_path.join(&self.path)
}
}
fn load(&self, cx: &AppContext) -> Task<Result<String>> {