Add settings to remote servers, use XDG paths on remote, and enable node LSPs (#19176)
Supersedes https://github.com/zed-industries/zed/pull/19166 TODO: - [x] Update basic zed paths - [x] update create_state_directory - [x] Use this with `NodeRuntime` - [x] Add server settings - [x] Add an 'open server settings command' - [x] Make sure it all works Release Notes: - Updated the actions `zed::OpenLocalSettings` and `zed::OpenLocalTasks` to `zed::OpenProjectSettings` and `zed::OpenProjectTasks`. --------- Co-authored-by: Conrad <conrad@zed.dev> Co-authored-by: Richard <richard@zed.dev>
This commit is contained in:
parent
1dda039f38
commit
f944ebc4cb
44 changed files with 804 additions and 218 deletions
|
@ -27,13 +27,14 @@ use anyhow::Context as _;
|
|||
use assets::Assets;
|
||||
use futures::{channel::mpsc, select_biased, StreamExt};
|
||||
use outline_panel::OutlinePanel;
|
||||
use project::Item;
|
||||
use project_panel::ProjectPanel;
|
||||
use quick_action_bar::QuickActionBar;
|
||||
use release_channel::{AppCommitSha, ReleaseChannel};
|
||||
use rope::Rope;
|
||||
use search::project_search::ProjectSearchBar;
|
||||
use settings::{
|
||||
initial_local_settings_content, initial_tasks_content, KeymapFile, Settings, SettingsStore,
|
||||
initial_project_settings_content, initial_tasks_content, KeymapFile, Settings, SettingsStore,
|
||||
DEFAULT_KEYMAP_PATH,
|
||||
};
|
||||
use std::any::TypeId;
|
||||
|
@ -53,7 +54,9 @@ use workspace::{
|
|||
open_new, AppState, NewFile, NewWindow, OpenLog, Toast, Workspace, WorkspaceSettings,
|
||||
};
|
||||
use workspace::{notifications::DetachAndPromptErr, Pane};
|
||||
use zed_actions::{OpenAccountSettings, OpenBrowser, OpenSettings, OpenZedUrl, Quit};
|
||||
use zed_actions::{
|
||||
OpenAccountSettings, OpenBrowser, OpenServerSettings, OpenSettings, OpenZedUrl, Quit,
|
||||
};
|
||||
|
||||
actions!(
|
||||
zed,
|
||||
|
@ -64,8 +67,8 @@ actions!(
|
|||
Minimize,
|
||||
OpenDefaultKeymap,
|
||||
OpenDefaultSettings,
|
||||
OpenLocalSettings,
|
||||
OpenLocalTasks,
|
||||
OpenProjectSettings,
|
||||
OpenProjectTasks,
|
||||
OpenTasks,
|
||||
ResetDatabase,
|
||||
ShowAll,
|
||||
|
@ -218,6 +221,7 @@ pub fn initialize_workspace(
|
|||
|
||||
let handle = cx.view().downgrade();
|
||||
cx.on_window_should_close(move |cx| {
|
||||
|
||||
handle
|
||||
.update(cx, |workspace, cx| {
|
||||
// We'll handle closing asynchronously
|
||||
|
@ -428,8 +432,8 @@ pub fn initialize_workspace(
|
|||
);
|
||||
},
|
||||
)
|
||||
.register_action(open_local_settings_file)
|
||||
.register_action(open_local_tasks_file)
|
||||
.register_action(open_project_settings_file)
|
||||
.register_action(open_project_tasks_file)
|
||||
.register_action(
|
||||
move |workspace: &mut Workspace,
|
||||
_: &OpenDefaultKeymap,
|
||||
|
@ -521,6 +525,25 @@ pub fn initialize_workspace(
|
|||
}
|
||||
}
|
||||
});
|
||||
if workspace.project().read(cx).is_via_ssh() {
|
||||
workspace.register_action({
|
||||
move |workspace, _: &OpenServerSettings, cx| {
|
||||
let open_server_settings = workspace.project().update(cx, |project, cx| {
|
||||
project.open_server_settings(cx)
|
||||
});
|
||||
|
||||
cx.spawn(|workspace, mut cx| async move {
|
||||
let buffer = open_server_settings.await?;
|
||||
|
||||
workspace.update(&mut cx, |workspace, cx| {
|
||||
workspace.open_path(buffer.read(cx).project_path(cx).expect("Settings file must have a location"), None, true, cx)
|
||||
})?.await?;
|
||||
|
||||
anyhow::Ok(())
|
||||
}).detach_and_log_err(cx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
workspace.focus_handle(cx).focus(cx);
|
||||
})
|
||||
|
@ -813,22 +836,22 @@ pub fn load_default_keymap(cx: &mut AppContext) {
|
|||
}
|
||||
}
|
||||
|
||||
fn open_local_settings_file(
|
||||
fn open_project_settings_file(
|
||||
workspace: &mut Workspace,
|
||||
_: &OpenLocalSettings,
|
||||
_: &OpenProjectSettings,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) {
|
||||
open_local_file(
|
||||
workspace,
|
||||
local_settings_file_relative_path(),
|
||||
initial_local_settings_content(),
|
||||
initial_project_settings_content(),
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
fn open_local_tasks_file(
|
||||
fn open_project_tasks_file(
|
||||
workspace: &mut Workspace,
|
||||
_: &OpenLocalTasks,
|
||||
_: &OpenProjectTasks,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) {
|
||||
open_local_file(
|
||||
|
|
|
@ -19,7 +19,7 @@ pub fn app_menus() -> Vec<Menu> {
|
|||
MenuItem::action("Open Key Bindings", zed_actions::OpenKeymap),
|
||||
MenuItem::action("Open Default Settings", super::OpenDefaultSettings),
|
||||
MenuItem::action("Open Default Key Bindings", super::OpenDefaultKeymap),
|
||||
MenuItem::action("Open Local Settings", super::OpenLocalSettings),
|
||||
MenuItem::action("Open Project Settings", super::OpenProjectSettings),
|
||||
MenuItem::action("Select Theme...", theme_selector::Toggle::default()),
|
||||
],
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue