Allow using system node (#18172)
Release Notes: - (Potentially breaking change) Zed will now use the node installed on your $PATH (if it is more recent than v18) instead of downloading its own. You can disable the new behavior with `{"node": {"disable_path_lookup": true}}` in your settings. We do not yet use system/project-local node_modules. --------- Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
e4080ef565
commit
3ba071b993
34 changed files with 614 additions and 391 deletions
|
@ -30,7 +30,7 @@ use crate::{
|
|||
};
|
||||
|
||||
pub struct PrettierStore {
|
||||
node: Arc<dyn NodeRuntime>,
|
||||
node: NodeRuntime,
|
||||
fs: Arc<dyn Fs>,
|
||||
languages: Arc<LanguageRegistry>,
|
||||
worktree_store: Model<WorktreeStore>,
|
||||
|
@ -52,7 +52,7 @@ impl EventEmitter<PrettierStoreEvent> for PrettierStore {}
|
|||
|
||||
impl PrettierStore {
|
||||
pub fn new(
|
||||
node: Arc<dyn NodeRuntime>,
|
||||
node: NodeRuntime,
|
||||
fs: Arc<dyn Fs>,
|
||||
languages: Arc<LanguageRegistry>,
|
||||
worktree_store: Model<WorktreeStore>,
|
||||
|
@ -212,7 +212,7 @@ impl PrettierStore {
|
|||
}
|
||||
|
||||
fn start_prettier(
|
||||
node: Arc<dyn NodeRuntime>,
|
||||
node: NodeRuntime,
|
||||
prettier_dir: PathBuf,
|
||||
worktree_id: Option<WorktreeId>,
|
||||
cx: &mut ModelContext<Self>,
|
||||
|
@ -241,7 +241,7 @@ impl PrettierStore {
|
|||
}
|
||||
|
||||
fn start_default_prettier(
|
||||
node: Arc<dyn NodeRuntime>,
|
||||
node: NodeRuntime,
|
||||
worktree_id: Option<WorktreeId>,
|
||||
cx: &mut ModelContext<PrettierStore>,
|
||||
) -> Task<anyhow::Result<PrettierTask>> {
|
||||
|
@ -749,7 +749,7 @@ impl DefaultPrettier {
|
|||
|
||||
pub fn prettier_task(
|
||||
&mut self,
|
||||
node: &Arc<dyn NodeRuntime>,
|
||||
node: &NodeRuntime,
|
||||
worktree_id: Option<WorktreeId>,
|
||||
cx: &mut ModelContext<PrettierStore>,
|
||||
) -> Option<Task<anyhow::Result<PrettierTask>>> {
|
||||
|
@ -767,7 +767,7 @@ impl DefaultPrettier {
|
|||
impl PrettierInstance {
|
||||
pub fn prettier_task(
|
||||
&mut self,
|
||||
node: &Arc<dyn NodeRuntime>,
|
||||
node: &NodeRuntime,
|
||||
prettier_dir: Option<&Path>,
|
||||
worktree_id: Option<WorktreeId>,
|
||||
cx: &mut ModelContext<PrettierStore>,
|
||||
|
@ -786,7 +786,7 @@ impl PrettierInstance {
|
|||
None => match prettier_dir {
|
||||
Some(prettier_dir) => {
|
||||
let new_task = PrettierStore::start_prettier(
|
||||
Arc::clone(node),
|
||||
node.clone(),
|
||||
prettier_dir.to_path_buf(),
|
||||
worktree_id,
|
||||
cx,
|
||||
|
@ -797,7 +797,7 @@ impl PrettierInstance {
|
|||
}
|
||||
None => {
|
||||
self.attempt += 1;
|
||||
let node = Arc::clone(node);
|
||||
let node = node.clone();
|
||||
cx.spawn(|prettier_store, mut cx| async move {
|
||||
prettier_store
|
||||
.update(&mut cx, |_, cx| {
|
||||
|
@ -818,7 +818,7 @@ impl PrettierInstance {
|
|||
async fn install_prettier_packages(
|
||||
fs: &dyn Fs,
|
||||
plugins_to_install: HashSet<Arc<str>>,
|
||||
node: Arc<dyn NodeRuntime>,
|
||||
node: NodeRuntime,
|
||||
) -> anyhow::Result<()> {
|
||||
let packages_to_versions = future::try_join_all(
|
||||
plugins_to_install
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue