fully qualify paths inside conditional compilation methods

This commit is contained in:
KCaverly 2023-10-24 13:35:28 +02:00
parent 8ffe5a3ec7
commit 0dd45bbf21

View file

@ -53,7 +53,7 @@ use lsp::{
use lsp_command::*; use lsp_command::*;
use node_runtime::NodeRuntime; use node_runtime::NodeRuntime;
use postage::watch; use postage::watch;
use prettier::{LocateStart, Prettier, PRETTIER_SERVER_FILE, PRETTIER_SERVER_JS}; use prettier::{LocateStart, Prettier};
use project_settings::{LspSettings, ProjectSettings}; use project_settings::{LspSettings, ProjectSettings};
use rand::prelude::*; use rand::prelude::*;
use search::SearchQuery; use search::SearchQuery;
@ -79,13 +79,10 @@ use std::{
time::{Duration, Instant}, time::{Duration, Instant},
}; };
use terminals::Terminals; use terminals::Terminals;
use text::{Anchor, LineEnding, Rope}; use text::Anchor;
use util::{ use util::{
debug_panic, defer, debug_panic, defer, http::HttpClient, merge_json_value_into,
http::HttpClient, paths::LOCAL_SETTINGS_RELATIVE_PATH, post_inc, ResultExt, TryFutureExt as _,
merge_json_value_into,
paths::{DEFAULT_PRETTIER_DIR, LOCAL_SETTINGS_RELATIVE_PATH},
post_inc, ResultExt, TryFutureExt as _,
}; };
pub use fs::*; pub use fs::*;
@ -8531,7 +8528,7 @@ impl Project {
return Task::ready(Ok(())); return Task::ready(Ok(()));
}; };
let default_prettier_dir = DEFAULT_PRETTIER_DIR.as_path(); let default_prettier_dir = util::paths::DEFAULT_PRETTIER_DIR.as_path();
let already_running_prettier = self let already_running_prettier = self
.prettier_instances .prettier_instances
.get(&(worktree, default_prettier_dir.to_path_buf())) .get(&(worktree, default_prettier_dir.to_path_buf()))
@ -8540,10 +8537,10 @@ impl Project {
let fs = Arc::clone(&self.fs); let fs = Arc::clone(&self.fs);
cx.background() cx.background()
.spawn(async move { .spawn(async move {
let prettier_wrapper_path = default_prettier_dir.join(PRETTIER_SERVER_FILE); let prettier_wrapper_path = default_prettier_dir.join(prettier::PRETTIER_SERVER_FILE);
// method creates parent directory if it doesn't exist // method creates parent directory if it doesn't exist
fs.save(&prettier_wrapper_path, &Rope::from(PRETTIER_SERVER_JS), LineEnding::Unix).await fs.save(&prettier_wrapper_path, &text::Rope::from(prettier::PRETTIER_SERVER_JS), text::LineEnding::Unix).await
.with_context(|| format!("writing {PRETTIER_SERVER_FILE} file at {prettier_wrapper_path:?}"))?; .with_context(|| format!("writing {prettier::PRETTIER_SERVER_FILE} file at {prettier_wrapper_path:?}"))?;
let packages_to_versions = future::try_join_all( let packages_to_versions = future::try_join_all(
prettier_plugins prettier_plugins