Use enum variants for prettier installation and startup phases
This commit is contained in:
parent
d010f5f98d
commit
c288c6eaf9
2 changed files with 227 additions and 221 deletions
|
@ -13,12 +13,14 @@ use node_runtime::NodeRuntime;
|
|||
use serde::{Deserialize, Serialize};
|
||||
use util::paths::{PathMatcher, DEFAULT_PRETTIER_DIR};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Prettier {
|
||||
Real(RealPrettier),
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
Test(TestPrettier),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct RealPrettier {
|
||||
default: bool,
|
||||
prettier_dir: PathBuf,
|
||||
|
@ -26,11 +28,13 @@ pub struct RealPrettier {
|
|||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
#[derive(Clone)]
|
||||
pub struct TestPrettier {
|
||||
prettier_dir: PathBuf,
|
||||
default: bool,
|
||||
}
|
||||
|
||||
pub const LAUNCH_THRESHOLD: usize = 5;
|
||||
pub const PRETTIER_SERVER_FILE: &str = "prettier_server.js";
|
||||
pub const PRETTIER_SERVER_JS: &str = include_str!("./prettier_server.js");
|
||||
const PRETTIER_PACKAGE_NAME: &str = "prettier";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue