mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
port command_palette
This commit is contained in:
parent
10784e3f03
commit
12c9198fcf
16 changed files with 19 additions and 87 deletions
32
Cargo.lock
generated
32
Cargo.lock
generated
|
@ -2513,34 +2513,6 @@ dependencies = [
|
|||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "command_palette"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"client",
|
||||
"collections",
|
||||
"command_palette_hooks",
|
||||
"ctor",
|
||||
"editor",
|
||||
"env_logger 0.11.5",
|
||||
"fuzzy",
|
||||
"go_to_line",
|
||||
"gpui",
|
||||
"language",
|
||||
"menu",
|
||||
"picker",
|
||||
"postage",
|
||||
"project",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"settings",
|
||||
"theme",
|
||||
"ui",
|
||||
"util",
|
||||
"workspace",
|
||||
"zed_actions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "command_palette_hooks"
|
||||
version = "0.1.0"
|
||||
|
@ -14499,7 +14471,6 @@ dependencies = [
|
|||
"cli",
|
||||
"client",
|
||||
"collections",
|
||||
"command_palette",
|
||||
"command_palette_hooks",
|
||||
"context_servers",
|
||||
"copilot",
|
||||
|
@ -14620,7 +14591,6 @@ dependencies = [
|
|||
"client",
|
||||
"clock",
|
||||
"collections",
|
||||
"command_palette",
|
||||
"command_palette_hooks",
|
||||
"context_servers",
|
||||
"copilot",
|
||||
|
@ -14641,6 +14611,7 @@ dependencies = [
|
|||
"fuzzy",
|
||||
"git",
|
||||
"globset",
|
||||
"go_to_line",
|
||||
"google_ai",
|
||||
"gpui",
|
||||
"handlebars 4.5.0",
|
||||
|
@ -14673,6 +14644,7 @@ dependencies = [
|
|||
"parking_lot",
|
||||
"paths",
|
||||
"picker",
|
||||
"postage",
|
||||
"pretty_assertions",
|
||||
"project",
|
||||
"proto",
|
||||
|
|
|
@ -12,7 +12,6 @@ members = [
|
|||
"crates/clock",
|
||||
"crates/collab",
|
||||
"crates/collections",
|
||||
"crates/command_palette",
|
||||
"crates/command_palette_hooks",
|
||||
"crates/context_servers",
|
||||
"crates/copilot",
|
||||
|
@ -161,7 +160,6 @@ client = { path = "crates/client" }
|
|||
clock = { path = "crates/clock" }
|
||||
collab = { path = "crates/collab" }
|
||||
collections = { path = "crates/collections" }
|
||||
command_palette = { path = "crates/command_palette" }
|
||||
command_palette_hooks = { path = "crates/command_palette_hooks" }
|
||||
context_servers = { path = "crates/context_servers" }
|
||||
copilot = { path = "crates/copilot" }
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
[package]
|
||||
name = "command_palette"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[lib]
|
||||
path = "src/command_palette.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
client.workspace = true
|
||||
collections.workspace = true
|
||||
command_palette_hooks.workspace = true
|
||||
fuzzy.workspace = true
|
||||
gpui.workspace = true
|
||||
picker.workspace = true
|
||||
postage.workspace = true
|
||||
serde.workspace = true
|
||||
settings.workspace = true
|
||||
theme.workspace = true
|
||||
ui.workspace = true
|
||||
util.workspace = true
|
||||
workspace.workspace = true
|
||||
zed_actions.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
ctor.workspace = true
|
||||
editor = { workspace = true, features = ["test-support"] }
|
||||
env_logger.workspace = true
|
||||
go_to_line.workspace = true
|
||||
gpui = { workspace = true, features = ["test-support"] }
|
||||
language = { workspace = true, features = ["test-support"] }
|
||||
menu.workspace = true
|
||||
project = { workspace = true, features = ["test-support"] }
|
||||
serde_json.workspace = true
|
||||
workspace = { workspace = true, features = ["test-support"] }
|
|
@ -1 +0,0 @@
|
|||
../../LICENSE-GPL
|
|
@ -27,7 +27,6 @@ clap.workspace = true
|
|||
cli.workspace = true
|
||||
client.workspace = true
|
||||
collections.workspace = true
|
||||
command_palette.workspace = true
|
||||
command_palette_hooks.workspace = true
|
||||
context_servers.workspace = true
|
||||
copilot.workspace = true
|
||||
|
|
|
@ -377,7 +377,7 @@ fn main() {
|
|||
|
||||
SystemAppearance::init(cx);
|
||||
theme::init(theme::LoadThemes::All(Box::new(Assets)), cx);
|
||||
command_palette::init(cx);
|
||||
zed_common::command_palette::init(cx);
|
||||
let copilot_language_server_id = app_state.languages.next_language_server_id();
|
||||
copilot::init(
|
||||
copilot_language_server_id,
|
||||
|
|
|
@ -3487,7 +3487,7 @@ mod tests {
|
|||
workspace::init(app_state.clone(), cx);
|
||||
Project::init_settings(cx);
|
||||
release_channel::init(SemanticVersion::default(), cx);
|
||||
command_palette::init(cx);
|
||||
zed_common::command_palette::init(cx);
|
||||
language::init(cx);
|
||||
editor::init(cx);
|
||||
zed_common::collab_ui::init(&app_state, cx);
|
||||
|
|
|
@ -149,7 +149,7 @@ pub fn app_menus() -> Vec<Menu> {
|
|||
MenuItem::action("Back", workspace::GoBack),
|
||||
MenuItem::action("Forward", workspace::GoForward),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Command Palette...", command_palette::Toggle),
|
||||
MenuItem::action("Command Palette...", zed_common::command_palette::Toggle),
|
||||
MenuItem::separator(),
|
||||
MenuItem::action("Go to File...", workspace::ToggleFileFinder::default()),
|
||||
// MenuItem::action("Go to Symbol in Project", project_symbols::Toggle),
|
||||
|
|
|
@ -47,7 +47,6 @@ chrono.workspace = true
|
|||
client.workspace = true
|
||||
clock.workspace = true
|
||||
collections.workspace = true
|
||||
command_palette.workspace = true
|
||||
command_palette_hooks.workspace = true
|
||||
context_servers.workspace = true
|
||||
copilot = { workspace = true, features = ["schemars"] }
|
||||
|
@ -96,6 +95,7 @@ outline.workspace = true
|
|||
parking_lot.workspace = true
|
||||
paths.workspace = true
|
||||
picker.workspace = true
|
||||
postage.workspace = true
|
||||
project.workspace = true
|
||||
proto.workspace = true
|
||||
regex.workspace = true
|
||||
|
@ -157,6 +157,7 @@ env_logger.workspace = true
|
|||
extension_host = {workspace = true, features = ["test-support"] }
|
||||
fs = { workspace = true, features = ["test-support"] }
|
||||
gpui = { workspace = true, features = ["test-support"] }
|
||||
go_to_line.workspace = true
|
||||
http_client = { workspace = true, features = ["test-support"] }
|
||||
indexed_docs.workspace = true
|
||||
indoc.workspace = true
|
||||
|
|
|
@ -4,6 +4,7 @@ pub mod assistant_slash_command;
|
|||
pub mod auto_update;
|
||||
pub mod breadcrumbs;
|
||||
pub mod collab_ui;
|
||||
pub mod command_palette;
|
||||
pub mod extensions_ui;
|
||||
pub mod file_finder;
|
||||
pub mod inline_completion_button;
|
||||
|
|
|
@ -18,7 +18,10 @@ impl Render for ApplicationMenu {
|
|||
.menu(move |cx| {
|
||||
ContextMenu::build(cx, move |menu, cx| {
|
||||
menu.header("Workspace")
|
||||
.action("Open Command Palette", Box::new(command_palette::Toggle))
|
||||
.action(
|
||||
"Open Command Palette",
|
||||
Box::new(crate::command_palette::Toggle),
|
||||
)
|
||||
.when_some(cx.focused(), |menu, focused| menu.context(focused))
|
||||
.custom_row(move |cx| {
|
||||
h_flex()
|
||||
|
|
|
@ -93,7 +93,7 @@ pub fn register(editor: &mut Editor, cx: &mut ViewContext<Vim>) {
|
|||
return;
|
||||
};
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
command_palette::CommandPalette::toggle(workspace, "'<,'>", cx);
|
||||
crate::command_palette::CommandPalette::toggle(workspace, "'<,'>", cx);
|
||||
})
|
||||
});
|
||||
|
||||
|
@ -103,7 +103,7 @@ pub fn register(editor: &mut Editor, cx: &mut ViewContext<Vim>) {
|
|||
};
|
||||
let count = vim.take_count(cx).unwrap_or(1);
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
command_palette::CommandPalette::toggle(
|
||||
crate::command_palette::CommandPalette::toggle(
|
||||
workspace,
|
||||
&format!(".,.+{}", count.saturating_sub(1)),
|
||||
cx,
|
||||
|
|
|
@ -4,8 +4,8 @@ mod vim_test_context;
|
|||
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::command_palette::CommandPalette;
|
||||
use collections::HashMap;
|
||||
use command_palette::CommandPalette;
|
||||
use editor::{actions::DeleteLine, display_map::DisplayRow, DisplayPoint};
|
||||
use futures::StreamExt;
|
||||
use gpui::{KeyBinding, Modifiers, MouseButton, TestAppContext};
|
||||
|
|
|
@ -19,7 +19,7 @@ impl VimTestContext {
|
|||
let settings = SettingsStore::test(cx);
|
||||
cx.set_global(settings);
|
||||
release_channel::init(SemanticVersion::default(), cx);
|
||||
command_palette::init(cx);
|
||||
crate::command_palette::init(cx);
|
||||
crate::vim::init(cx);
|
||||
search::init(cx);
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ dest_path = f"crates/zed_common/src/{crate_name}"
|
|||
# Move the crate to zed_common
|
||||
if os.path.exists(src_path):
|
||||
shutil.move(src_path, dest_path)
|
||||
print(f"Moved code to zed_common")
|
||||
print("Moved code to zed_common")
|
||||
else:
|
||||
print(f"Source path {src_path} does not exist")
|
||||
|
||||
|
@ -30,7 +30,7 @@ for root, dirs, files in os.walk(dest_path):
|
|||
if file.endswith(".rs"):
|
||||
with open(os.path.join(root, file), "r") as f:
|
||||
content = f.read()
|
||||
new_content = content.replace(f"crate::", f"crate::{crate_name}::")
|
||||
new_content = content.replace("crate::", f"crate::{crate_name}::")
|
||||
if new_content != content:
|
||||
with open(os.path.join(root, file), "w") as f:
|
||||
f.write(new_content)
|
||||
|
@ -41,7 +41,7 @@ print("Fixed imports")
|
|||
with open("Cargo.toml", "r") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
new_lines = [line for line in lines if not (f"crates/{crate_name}" in line or f"{crate_name}.workspace = true" in line)]
|
||||
new_lines = [line for line in lines if not (f"crates/{crate_name}\"" in line or f"{crate_name}.workspace = true" in line)]
|
||||
|
||||
if len(new_lines) != len(lines):
|
||||
with open("Cargo.toml", "w") as f:
|
||||
|
|
Loading…
Reference in a new issue