Merge branch 'main' into feedback-2
This commit is contained in:
commit
d2362d7f12
114 changed files with 12427 additions and 4903 deletions
|
@ -2,7 +2,7 @@
|
|||
description = "The fast, collaborative code editor."
|
||||
edition = "2021"
|
||||
name = "zed2"
|
||||
version = "0.109.0"
|
||||
version = "2.0.0"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
@ -49,14 +49,14 @@ lsp = { package = "lsp2", path = "../lsp2" }
|
|||
menu = { package = "menu2", path = "../menu2" }
|
||||
# language_tools = { path = "../language_tools" }
|
||||
node_runtime = { path = "../node_runtime" }
|
||||
# assistant = { path = "../assistant" }
|
||||
assistant = { package = "assistant2", path = "../assistant2" }
|
||||
outline = { package = "outline2", path = "../outline2" }
|
||||
# plugin_runtime = { path = "../plugin_runtime",optional = true }
|
||||
project = { package = "project2", path = "../project2" }
|
||||
project_panel = { package = "project_panel2", path = "../project_panel2" }
|
||||
# project_symbols = { path = "../project_symbols" }
|
||||
# quick_action_bar = { path = "../quick_action_bar" }
|
||||
# recent_projects = { path = "../recent_projects" }
|
||||
quick_action_bar = { package = "quick_action_bar2", path = "../quick_action_bar2" }
|
||||
recent_projects = { package = "recent_projects2", path = "../recent_projects2" }
|
||||
rope = { package = "rope2", path = "../rope2"}
|
||||
rpc = { package = "rpc2", path = "../rpc2" }
|
||||
settings = { package = "settings2", path = "../settings2" }
|
||||
|
@ -68,13 +68,13 @@ terminal_view = { package = "terminal_view2", path = "../terminal_view2" }
|
|||
theme = { package = "theme2", path = "../theme2" }
|
||||
theme_selector = { package = "theme_selector2", path = "../theme_selector2" }
|
||||
util = { path = "../util" }
|
||||
# semantic_index = { path = "../semantic_index" }
|
||||
semantic_index = { package = "semantic_index2", path = "../semantic_index2" }
|
||||
# vim = { path = "../vim" }
|
||||
workspace = { package = "workspace2", path = "../workspace2" }
|
||||
welcome = { package = "welcome2", path = "../welcome2" }
|
||||
zed_actions = {package = "zed_actions2", path = "../zed_actions2"}
|
||||
anyhow.workspace = true
|
||||
async-compression = { version = "0.3", features = ["gzip", "futures-bufread"] }
|
||||
async-compression.workspace = true
|
||||
async-tar = "0.4.2"
|
||||
async-recursion = "0.3"
|
||||
async-trait.workspace = true
|
||||
|
|
175
crates/zed2/src/app_menus.rs
Normal file
175
crates/zed2/src/app_menus.rs
Normal file
|
@ -0,0 +1,175 @@
|
|||
use gpui::{Menu, MenuItem, OsAction};
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn app_menus() -> Vec<Menu<'static>> {
|
||||
vec![
|
||||
Menu {
|
||||
name: "Zed",
|
||||
items: vec![
|
||||
MenuItem::action("About Zed…", super::About),
|
||||
MenuItem::action("Check for Updates", auto_update::Check),
|
||||
MenuItem::separator(),
|
||||
MenuItem::submenu(Menu {
|
||||
name: "Preferences",
|
||||
items: vec![
|
||||
MenuItem::action("Open Settings", super::OpenSettings),
|
||||
MenuItem::action("Open Key Bindings", super::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("Select Theme", theme_selector::Toggle),
|
||||
],
|
||||
}),
|
||||
MenuItem::action("Install CLI", install_cli::Install),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Hide Zed", super::Hide),
|
||||
MenuItem::action("Hide Others", super::HideOthers),
|
||||
MenuItem::action("Show All", super::ShowAll),
|
||||
MenuItem::action("Quit", super::Quit),
|
||||
],
|
||||
},
|
||||
Menu {
|
||||
name: "File",
|
||||
items: vec![
|
||||
MenuItem::action("New", workspace::NewFile),
|
||||
MenuItem::action("New Window", workspace::NewWindow),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Open…", workspace::Open),
|
||||
MenuItem::action("Open Recent...", recent_projects::OpenRecent),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Add Folder to Project…", workspace::AddFolderToProject),
|
||||
MenuItem::action("Save", workspace::Save { save_intent: None }),
|
||||
MenuItem::action("Save As…", workspace::SaveAs),
|
||||
MenuItem::action("Save All", workspace::SaveAll { save_intent: None }),
|
||||
MenuItem::action(
|
||||
"Close Editor",
|
||||
workspace::CloseActiveItem { save_intent: None },
|
||||
),
|
||||
MenuItem::action("Close Window", workspace::CloseWindow),
|
||||
],
|
||||
},
|
||||
Menu {
|
||||
name: "Edit",
|
||||
items: vec![
|
||||
MenuItem::os_action("Undo", editor::Undo, OsAction::Undo),
|
||||
MenuItem::os_action("Redo", editor::Redo, OsAction::Redo),
|
||||
MenuItem::separator(),
|
||||
MenuItem::os_action("Cut", editor::Cut, OsAction::Cut),
|
||||
MenuItem::os_action("Copy", editor::Copy, OsAction::Copy),
|
||||
MenuItem::os_action("Paste", editor::Paste, OsAction::Paste),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Find", search::buffer_search::Deploy { focus: true }),
|
||||
MenuItem::action("Find In Project", workspace::NewSearch),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Toggle Line Comment", editor::ToggleComments::default()),
|
||||
MenuItem::action("Emoji & Symbols", editor::ShowCharacterPalette),
|
||||
],
|
||||
},
|
||||
Menu {
|
||||
name: "Selection",
|
||||
items: vec![
|
||||
MenuItem::os_action("Select All", editor::SelectAll, OsAction::SelectAll),
|
||||
MenuItem::action("Expand Selection", editor::SelectLargerSyntaxNode),
|
||||
MenuItem::action("Shrink Selection", editor::SelectSmallerSyntaxNode),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Add Cursor Above", editor::AddSelectionAbove),
|
||||
MenuItem::action("Add Cursor Below", editor::AddSelectionBelow),
|
||||
MenuItem::action(
|
||||
"Select Next Occurrence",
|
||||
editor::SelectNext {
|
||||
replace_newest: false,
|
||||
},
|
||||
),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Move Line Up", editor::MoveLineUp),
|
||||
MenuItem::action("Move Line Down", editor::MoveLineDown),
|
||||
MenuItem::action("Duplicate Selection", editor::DuplicateLine),
|
||||
],
|
||||
},
|
||||
Menu {
|
||||
name: "View",
|
||||
items: vec![
|
||||
MenuItem::action("Zoom In", super::IncreaseBufferFontSize),
|
||||
MenuItem::action("Zoom Out", super::DecreaseBufferFontSize),
|
||||
MenuItem::action("Reset Zoom", super::ResetBufferFontSize),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Toggle Left Dock", workspace::ToggleLeftDock),
|
||||
MenuItem::action("Toggle Right Dock", workspace::ToggleRightDock),
|
||||
MenuItem::action("Toggle Bottom Dock", workspace::ToggleBottomDock),
|
||||
MenuItem::action("Close All Docks", workspace::CloseAllDocks),
|
||||
MenuItem::submenu(Menu {
|
||||
name: "Editor Layout",
|
||||
items: vec![
|
||||
MenuItem::action("Split Up", workspace::SplitUp),
|
||||
MenuItem::action("Split Down", workspace::SplitDown),
|
||||
MenuItem::action("Split Left", workspace::SplitLeft),
|
||||
MenuItem::action("Split Right", workspace::SplitRight),
|
||||
],
|
||||
}),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Project Panel", project_panel::ToggleFocus),
|
||||
MenuItem::action("Command Palette", command_palette::Toggle),
|
||||
MenuItem::action("Diagnostics", diagnostics::Deploy),
|
||||
MenuItem::separator(),
|
||||
],
|
||||
},
|
||||
Menu {
|
||||
name: "Go",
|
||||
items: vec![
|
||||
MenuItem::action("Back", workspace::GoBack),
|
||||
MenuItem::action("Forward", workspace::GoForward),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Go to File", file_finder::Toggle),
|
||||
// MenuItem::action("Go to Symbol in Project", project_symbols::Toggle),
|
||||
MenuItem::action("Go to Symbol in Editor", outline::Toggle),
|
||||
MenuItem::action("Go to Definition", editor::GoToDefinition),
|
||||
MenuItem::action("Go to Type Definition", editor::GoToTypeDefinition),
|
||||
MenuItem::action("Find All References", editor::FindAllReferences),
|
||||
MenuItem::action("Go to Line/Column", go_to_line::Toggle),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Next Problem", editor::GoToDiagnostic),
|
||||
MenuItem::action("Previous Problem", editor::GoToPrevDiagnostic),
|
||||
],
|
||||
},
|
||||
Menu {
|
||||
name: "Window",
|
||||
items: vec![
|
||||
MenuItem::action("Minimize", super::Minimize),
|
||||
MenuItem::action("Zoom", super::Zoom),
|
||||
MenuItem::separator(),
|
||||
],
|
||||
},
|
||||
Menu {
|
||||
name: "Help",
|
||||
items: vec![
|
||||
MenuItem::action("Command Palette", command_palette::Toggle),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("View Telemetry", crate::OpenTelemetryLog),
|
||||
MenuItem::action("View Dependency Licenses", crate::OpenLicenses),
|
||||
MenuItem::action("Show Welcome", workspace::Welcome),
|
||||
MenuItem::separator(),
|
||||
// todo!(): Needs `feedback2` crate.
|
||||
// MenuItem::action("Give us feedback", feedback::feedback_editor::GiveFeedback),
|
||||
// MenuItem::action(
|
||||
// "Copy System Specs Into Clipboard",
|
||||
// feedback::CopySystemSpecsIntoClipboard,
|
||||
// ),
|
||||
// MenuItem::action("File Bug Report", feedback::FileBugReport),
|
||||
// MenuItem::action("Request Feature", feedback::RequestFeature),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action(
|
||||
"Documentation",
|
||||
crate::OpenBrowser {
|
||||
url: "https://zed.dev/docs".into(),
|
||||
},
|
||||
),
|
||||
MenuItem::action(
|
||||
"Zed Twitter",
|
||||
crate::OpenBrowser {
|
||||
url: "https://twitter.com/zeddotdev".into(),
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
|
@ -22,8 +22,7 @@ use node_runtime::RealNodeRuntime;
|
|||
use parking_lot::Mutex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use settings::{
|
||||
default_settings, handle_keymap_file_changes, handle_settings_file_changes, watch_config_file,
|
||||
Settings, SettingsStore,
|
||||
default_settings, handle_settings_file_changes, watch_config_file, Settings, SettingsStore,
|
||||
};
|
||||
use simplelog::ConfigBuilder;
|
||||
use smol::process::Command;
|
||||
|
@ -51,8 +50,9 @@ use uuid::Uuid;
|
|||
use welcome::{show_welcome_experience, FIRST_OPEN};
|
||||
use workspace::{AppState, WorkspaceStore};
|
||||
use zed2::{
|
||||
build_window_options, ensure_only_instance, handle_cli_connection, initialize_workspace,
|
||||
languages, Assets, IsOnlyInstance, OpenListener, OpenRequest,
|
||||
app_menus, build_window_options, ensure_only_instance, handle_cli_connection,
|
||||
handle_keymap_file_changes, initialize_workspace, languages, Assets, IsOnlyInstance,
|
||||
OpenListener, OpenRequest,
|
||||
};
|
||||
|
||||
mod open_listener;
|
||||
|
@ -161,11 +161,11 @@ fn main() {
|
|||
node_runtime.clone(),
|
||||
cx,
|
||||
);
|
||||
// assistant::init(cx);
|
||||
assistant::init(cx);
|
||||
// component_test::init(cx);
|
||||
|
||||
// cx.spawn(|_| watch_languages(fs.clone(), languages.clone()))
|
||||
// .detach();
|
||||
cx.spawn(|_| watch_languages(fs.clone(), languages.clone()))
|
||||
.detach();
|
||||
watch_file_types(fs.clone(), cx);
|
||||
|
||||
languages.set_theme(cx.theme().clone());
|
||||
|
@ -186,10 +186,10 @@ fn main() {
|
|||
.report_app_event(telemetry_settings, event_operation);
|
||||
|
||||
let app_state = Arc::new(AppState {
|
||||
languages,
|
||||
languages: languages.clone(),
|
||||
client: client.clone(),
|
||||
user_store: user_store.clone(),
|
||||
fs,
|
||||
fs: fs.clone(),
|
||||
build_window_options,
|
||||
workspace_store,
|
||||
node_runtime,
|
||||
|
@ -200,7 +200,7 @@ fn main() {
|
|||
auto_update::init(http.clone(), client::ZED_SERVER_URL.clone(), cx);
|
||||
|
||||
workspace::init(app_state.clone(), cx);
|
||||
// recent_projects::init(cx);
|
||||
recent_projects::init(cx);
|
||||
|
||||
go_to_line::init(cx);
|
||||
file_finder::init(cx);
|
||||
|
@ -210,7 +210,7 @@ fn main() {
|
|||
channel::init(&client, user_store.clone(), cx);
|
||||
// diagnostics::init(cx);
|
||||
search::init(cx);
|
||||
// semantic_index::init(fs.clone(), http.clone(), languages.clone(), cx);
|
||||
semantic_index::init(fs.clone(), http.clone(), languages.clone(), cx);
|
||||
// vim::init(cx);
|
||||
terminal_view::init(cx);
|
||||
|
||||
|
@ -224,7 +224,7 @@ fn main() {
|
|||
feedback::init(cx);
|
||||
welcome::init(cx);
|
||||
|
||||
// cx.set_menus(menus::menus());
|
||||
cx.set_menus(app_menus());
|
||||
initialize_workspace(app_state.clone(), cx);
|
||||
|
||||
if stdout_is_a_pty() {
|
||||
|
|
|
@ -1,25 +1,30 @@
|
|||
#![allow(unused_variables, unused_mut)]
|
||||
//todo!()
|
||||
|
||||
mod app_menus;
|
||||
mod assets;
|
||||
pub mod languages;
|
||||
mod only_instance;
|
||||
mod open_listener;
|
||||
|
||||
pub use app_menus::*;
|
||||
pub use assets::*;
|
||||
use assistant::AssistantPanel;
|
||||
use breadcrumbs::Breadcrumbs;
|
||||
use collections::VecDeque;
|
||||
use editor::{Editor, MultiBuffer};
|
||||
use gpui::{
|
||||
actions, point, px, AppContext, Context, FocusableView, PromptLevel, TitlebarOptions,
|
||||
actions, point, px, AppContext, Context, FocusableView, PromptLevel, TitlebarOptions, View,
|
||||
ViewContext, VisualContext, WindowBounds, WindowKind, WindowOptions,
|
||||
};
|
||||
pub use only_instance::*;
|
||||
pub use open_listener::*;
|
||||
|
||||
use anyhow::{anyhow, Context as _};
|
||||
use futures::{channel::mpsc, StreamExt};
|
||||
use project_panel::ProjectPanel;
|
||||
use settings::{initial_local_settings_content, Settings};
|
||||
use quick_action_bar::QuickActionBar;
|
||||
use settings::{initial_local_settings_content, load_default_keymap, KeymapFile, Settings};
|
||||
use std::{borrow::Cow, ops::Deref, sync::Arc};
|
||||
use terminal_view::terminal_panel::TerminalPanel;
|
||||
use util::{
|
||||
|
@ -29,6 +34,7 @@ use util::{
|
|||
ResultExt,
|
||||
};
|
||||
use uuid::Uuid;
|
||||
use workspace::Pane;
|
||||
use workspace::{
|
||||
create_and_open_local_file, dock::PanelHandle,
|
||||
notifications::simple_message_notification::MessageNotification, open_new, AppState, NewFile,
|
||||
|
@ -91,6 +97,8 @@ pub fn build_window_options(
|
|||
pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
||||
cx.observe_new_views(move |workspace: &mut Workspace, cx| {
|
||||
let workspace_handle = cx.view().clone();
|
||||
let center_pane = workspace.active_pane().clone();
|
||||
initialize_pane(workspace, ¢er_pane, cx);
|
||||
cx.subscribe(&workspace_handle, {
|
||||
move |workspace, _, event, cx| {
|
||||
if let workspace::Event::PaneAdded(pane) = event {
|
||||
|
@ -118,6 +126,8 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
|||
// toolbar.add_item(syntax_tree_item, cx);
|
||||
})
|
||||
});
|
||||
|
||||
initialize_pane(workspace, pane, cx);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -166,9 +176,7 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
|||
cx.on_window_should_close(move |cx| {
|
||||
handle
|
||||
.update(cx, |workspace, cx| {
|
||||
if let Some(task) = workspace.close(&Default::default(), cx) {
|
||||
task.detach_and_log_err(cx);
|
||||
}
|
||||
workspace.close_window(&Default::default(), cx);
|
||||
false
|
||||
})
|
||||
.unwrap_or(true)
|
||||
|
@ -177,7 +185,7 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
|||
cx.spawn(|workspace_handle, mut cx| async move {
|
||||
let project_panel = ProjectPanel::load(workspace_handle.clone(), cx.clone());
|
||||
let terminal_panel = TerminalPanel::load(workspace_handle.clone(), cx.clone());
|
||||
// let assistant_panel = AssistantPanel::load(workspace_handle.clone(), cx.clone());
|
||||
let assistant_panel = AssistantPanel::load(workspace_handle.clone(), cx.clone());
|
||||
let channels_panel =
|
||||
collab_ui::collab_panel::CollabPanel::load(workspace_handle.clone(), cx.clone());
|
||||
// let chat_panel =
|
||||
|
@ -189,14 +197,14 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
|||
let (
|
||||
project_panel,
|
||||
terminal_panel,
|
||||
// assistant_panel,
|
||||
assistant_panel,
|
||||
channels_panel,
|
||||
// chat_panel,
|
||||
// notification_panel,
|
||||
) = futures::try_join!(
|
||||
project_panel,
|
||||
terminal_panel,
|
||||
// assistant_panel,
|
||||
assistant_panel,
|
||||
channels_panel,
|
||||
// chat_panel,
|
||||
// notification_panel,
|
||||
|
@ -206,25 +214,25 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
|||
let project_panel_position = project_panel.position(cx);
|
||||
workspace.add_panel(project_panel, cx);
|
||||
workspace.add_panel(terminal_panel, cx);
|
||||
// workspace.add_panel(assistant_panel, cx);
|
||||
workspace.add_panel(assistant_panel, cx);
|
||||
workspace.add_panel(channels_panel, cx);
|
||||
// workspace.add_panel(chat_panel, cx);
|
||||
// workspace.add_panel(notification_panel, cx);
|
||||
|
||||
// if !was_deserialized
|
||||
// && workspace
|
||||
// .project()
|
||||
// .read(cx)
|
||||
// .visible_worktrees(cx)
|
||||
// .any(|tree| {
|
||||
// tree.read(cx)
|
||||
// .root_entry()
|
||||
// .map_or(false, |entry| entry.is_dir())
|
||||
// })
|
||||
// {
|
||||
// workspace.toggle_dock(project_panel_position, cx);
|
||||
// }
|
||||
// cx.focus_self();
|
||||
// if !was_deserialized
|
||||
// && workspace
|
||||
// .project()
|
||||
// .read(cx)
|
||||
// .visible_worktrees(cx)
|
||||
// .any(|tree| {
|
||||
// tree.read(cx)
|
||||
// .root_entry()
|
||||
// .map_or(false, |entry| entry.is_dir())
|
||||
// })
|
||||
// {
|
||||
// workspace.toggle_dock(project_panel_position, cx);
|
||||
// }
|
||||
cx.focus_self();
|
||||
})
|
||||
})
|
||||
.detach();
|
||||
|
@ -255,14 +263,13 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
|||
.open_urls(&[action.url.clone()])
|
||||
})
|
||||
.register_action(|_, action: &OpenBrowser, cx| cx.open_url(&action.url))
|
||||
//todo!(buffer font size)
|
||||
// cx.add_global_action(move |_: &IncreaseBufferFontSize, cx| {
|
||||
// theme::adjust_font_size(cx, |size| *size += 1.0)
|
||||
// });
|
||||
// cx.add_global_action(move |_: &DecreaseBufferFontSize, cx| {
|
||||
// theme::adjust_font_size(cx, |size| *size -= 1.0)
|
||||
// });
|
||||
// cx.add_global_action(move |_: &ResetBufferFontSize, cx| theme::reset_font_size(cx));
|
||||
.register_action(move |_, _: &IncreaseBufferFontSize, cx| {
|
||||
theme::adjust_font_size(cx, |size| *size += px(1.0))
|
||||
})
|
||||
.register_action(move |_, _: &DecreaseBufferFontSize, cx| {
|
||||
theme::adjust_font_size(cx, |size| *size -= px(1.0))
|
||||
})
|
||||
.register_action(move |_, _: &ResetBufferFontSize, cx| theme::reset_font_size(cx))
|
||||
.register_action(|_, _: &install_cli::Install, cx| {
|
||||
cx.spawn(|_, cx| async move {
|
||||
install_cli::install_cli(cx.deref())
|
||||
|
@ -434,6 +441,36 @@ pub fn initialize_workspace(app_state: Arc<AppState>, cx: &mut AppContext) {
|
|||
.detach();
|
||||
}
|
||||
|
||||
fn initialize_pane(workspace: &mut Workspace, pane: &View<Pane>, cx: &mut ViewContext<Workspace>) {
|
||||
pane.update(cx, |pane, cx| {
|
||||
pane.toolbar().update(cx, |toolbar, cx| {
|
||||
let breadcrumbs = cx.build_view(|_| Breadcrumbs::new(workspace));
|
||||
toolbar.add_item(breadcrumbs, cx);
|
||||
let buffer_search_bar = cx.build_view(search::BufferSearchBar::new);
|
||||
toolbar.add_item(buffer_search_bar.clone(), cx);
|
||||
|
||||
let quick_action_bar =
|
||||
cx.build_view(|_| QuickActionBar::new(buffer_search_bar, workspace));
|
||||
toolbar.add_item(quick_action_bar, cx);
|
||||
let diagnostic_editor_controls = cx.build_view(|_| diagnostics::ToolbarControls::new());
|
||||
// toolbar.add_item(diagnostic_editor_controls, cx);
|
||||
// let project_search_bar = cx.add_view(|_| ProjectSearchBar::new());
|
||||
// toolbar.add_item(project_search_bar, cx);
|
||||
// let submit_feedback_button =
|
||||
// cx.add_view(|_| SubmitFeedbackButton::new());
|
||||
// toolbar.add_item(submit_feedback_button, cx);
|
||||
// let feedback_info_text = cx.add_view(|_| FeedbackInfoText::new());
|
||||
// toolbar.add_item(feedback_info_text, cx);
|
||||
// let lsp_log_item =
|
||||
// cx.add_view(|_| language_tools::LspLogToolbarItemView::new());
|
||||
// toolbar.add_item(lsp_log_item, cx);
|
||||
// let syntax_tree_item = cx
|
||||
// .add_view(|_| language_tools::SyntaxTreeToolbarItemView::new());
|
||||
// toolbar.add_item(syntax_tree_item, cx);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
fn about(_: &mut Workspace, _: &About, cx: &mut gpui::ViewContext<Workspace>) {
|
||||
use std::fmt::Write as _;
|
||||
|
||||
|
@ -559,6 +596,42 @@ fn open_log_file(workspace: &mut Workspace, cx: &mut ViewContext<Workspace>) {
|
|||
.detach();
|
||||
}
|
||||
|
||||
pub fn handle_keymap_file_changes(
|
||||
mut user_keymap_file_rx: mpsc::UnboundedReceiver<String>,
|
||||
cx: &mut AppContext,
|
||||
) {
|
||||
cx.spawn(move |cx| async move {
|
||||
// let mut settings_subscription = None;
|
||||
while let Some(user_keymap_content) = user_keymap_file_rx.next().await {
|
||||
if let Some(keymap_content) = KeymapFile::parse(&user_keymap_content).log_err() {
|
||||
cx.update(|cx| reload_keymaps(cx, &keymap_content)).ok();
|
||||
|
||||
// todo!()
|
||||
// let mut old_base_keymap = cx.read(|cx| *settings::get::<BaseKeymap>(cx));
|
||||
// drop(settings_subscription);
|
||||
// settings_subscription = Some(cx.update(|cx| {
|
||||
// cx.observe_global::<SettingsStore, _>(move |cx| {
|
||||
// let new_base_keymap = *settings::get::<BaseKeymap>(cx);
|
||||
// if new_base_keymap != old_base_keymap {
|
||||
// old_base_keymap = new_base_keymap.clone();
|
||||
// reload_keymaps(cx, &keymap_content);
|
||||
// }
|
||||
// })
|
||||
// }));
|
||||
}
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
||||
fn reload_keymaps(cx: &mut AppContext, keymap_content: &KeymapFile) {
|
||||
// todo!()
|
||||
// cx.clear_bindings();
|
||||
load_default_keymap(cx);
|
||||
keymap_content.clone().add_to_cx(cx).log_err();
|
||||
cx.set_menus(app_menus());
|
||||
}
|
||||
|
||||
fn open_local_settings_file(
|
||||
workspace: &mut Workspace,
|
||||
_: &OpenLocalSettings,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue