Make the first prettier test pass
This commit is contained in:
parent
a528c6c686
commit
7f4ebf50d3
4 changed files with 124 additions and 29 deletions
|
@ -837,6 +837,16 @@ impl Project {
|
|||
project
|
||||
}
|
||||
|
||||
/// Enables a prettier mock that avoids interacting with node runtime, prettier LSP wrapper, or any real file changes.
|
||||
/// Instead, if appends the suffix to every input, this suffix is returned by this method.
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn enable_test_prettier(&mut self, plugins: &[&'static str]) -> &'static str {
|
||||
self.node = Some(node_runtime::FakeNodeRuntime::with_prettier_support(
|
||||
plugins,
|
||||
));
|
||||
Prettier::FORMAT_SUFFIX
|
||||
}
|
||||
|
||||
fn on_settings_changed(&mut self, cx: &mut ModelContext<Self>) {
|
||||
let mut language_servers_to_start = Vec::new();
|
||||
let mut language_formatters_to_check = Vec::new();
|
||||
|
@ -8442,7 +8452,7 @@ impl Project {
|
|||
return Some(existing_prettier);
|
||||
}
|
||||
|
||||
log::info!("Found prettier at {prettier_dir:?}, starting.");
|
||||
log::info!("Found prettier in {prettier_dir:?}, starting.");
|
||||
let task_prettier_dir = prettier_dir.clone();
|
||||
let weak_project = this.downgrade();
|
||||
let new_server_id =
|
||||
|
@ -8459,7 +8469,7 @@ impl Project {
|
|||
.await
|
||||
.context("prettier start")
|
||||
.map_err(Arc::new)?;
|
||||
log::info!("Had started prettier in {:?}", prettier.prettier_dir());
|
||||
log::info!("Started prettier in {:?}", prettier.prettier_dir());
|
||||
|
||||
if let Some((project, prettier_server)) =
|
||||
weak_project.upgrade(&mut cx).zip(prettier.server())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue