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:
Conrad Irwin 2024-09-23 15:28:04 -06:00 committed by GitHub
parent e4080ef565
commit 3ba071b993
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 614 additions and 391 deletions

View file

@ -153,7 +153,7 @@ pub struct Project {
git_diff_debouncer: DebouncedDelay<Self>,
remotely_created_models: Arc<Mutex<RemotelyCreatedModels>>,
terminals: Terminals,
node: Option<Arc<dyn NodeRuntime>>,
node: Option<NodeRuntime>,
tasks: Model<Inventory>,
hosted_project_id: Option<ProjectId>,
dev_server_project_id: Option<client::DevServerProjectId>,
@ -579,7 +579,7 @@ impl Project {
pub fn local(
client: Arc<Client>,
node: Arc<dyn NodeRuntime>,
node: NodeRuntime,
user_store: Model<UserStore>,
languages: Arc<LanguageRegistry>,
fs: Arc<dyn Fs>,
@ -675,7 +675,7 @@ impl Project {
pub fn ssh(
ssh: Arc<SshSession>,
client: Arc<Client>,
node: Arc<dyn NodeRuntime>,
node: NodeRuntime,
user_store: Model<UserStore>,
languages: Arc<LanguageRegistry>,
fs: Arc<dyn Fs>,
@ -1064,7 +1064,7 @@ impl Project {
.update(|cx| {
Project::local(
client,
node_runtime::FakeNodeRuntime::new(),
node_runtime::NodeRuntime::unavailable(),
user_store,
Arc::new(languages),
fs,
@ -1104,7 +1104,7 @@ impl Project {
let project = cx.update(|cx| {
Project::local(
client,
node_runtime::FakeNodeRuntime::new(),
node_runtime::NodeRuntime::unavailable(),
user_store,
Arc::new(languages),
fs,
@ -1157,7 +1157,7 @@ impl Project {
self.user_store.clone()
}
pub fn node_runtime(&self) -> Option<&Arc<dyn NodeRuntime>> {
pub fn node_runtime(&self) -> Option<&NodeRuntime> {
self.node.as_ref()
}