mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
feedback: Add action for listing installed extensions (#48664)
Closes #48037 - [X] Tests or screenshots needed? <--- Let me know if tests are needed - [ ] Code Reviewed - [X] Manual QA Release Notes: - Added action to copy installed extensions to clipboard <details><summary>Picture of Action</summary><img width="1924" height="1044" alt="Screenshot from 2026-03-03 01-00-22" src="https://github.com/user-attachments/assets/6abe9587-968d-48e9-a3b7-80602d26375d" /></details> <details><summary>Picture of Modal</summary> <img width="1920" height="1080" alt="Screenshot from 2026-03-03 01-00-35" src="https://github.com/user-attachments/assets/b30a743d-3324-4b01-a92c-a0476908e050" /> </details> <details><summary>Picture of Docs</summary> <img width="1936" height="1066" alt="Screenshot from 2026-03-03 01-19-53" src="https://github.com/user-attachments/assets/40dab840-c5e2-4248-b7a6-1924f0b6610c" /> </details> --------- Co-authored-by: MrSubidubi <finn@zed.dev>
This commit is contained in:
parent
0ddc7d0666
commit
f9662f484d
4 changed files with 46 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -6183,6 +6183,7 @@ dependencies = [
|
|||
name = "feedback"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"extension_host",
|
||||
"gpui",
|
||||
"system_specs",
|
||||
"urlencoding",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ path = "src/feedback.rs"
|
|||
test-support = []
|
||||
|
||||
[dependencies]
|
||||
extension_host.workspace = true
|
||||
gpui.workspace = true
|
||||
system_specs.workspace = true
|
||||
urlencoding.workspace = true
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
use extension_host::ExtensionStore;
|
||||
use gpui::{App, ClipboardItem, PromptLevel, actions};
|
||||
use system_specs::{CopySystemSpecsIntoClipboard, SystemSpecs};
|
||||
use util::ResultExt;
|
||||
|
|
@ -9,6 +10,8 @@ actions!(
|
|||
[
|
||||
/// Opens the Zed repository on GitHub.
|
||||
OpenZedRepo,
|
||||
/// Copies installed extensions to the clipboard for bug reports.
|
||||
CopyInstalledExtensionsIntoClipboard
|
||||
]
|
||||
);
|
||||
|
||||
|
|
@ -65,6 +68,17 @@ pub fn init(cx: &mut App) {
|
|||
})
|
||||
.detach();
|
||||
})
|
||||
.register_action(|_, _: &CopyInstalledExtensionsIntoClipboard, window, cx| {
|
||||
let clipboard_text = format_installed_extensions_for_clipboard(cx);
|
||||
cx.write_to_clipboard(ClipboardItem::new_string(clipboard_text.clone()));
|
||||
drop(window.prompt(
|
||||
PromptLevel::Info,
|
||||
"Copied into clipboard",
|
||||
Some(&clipboard_text),
|
||||
&["OK"],
|
||||
cx,
|
||||
));
|
||||
})
|
||||
.register_action(|_, _: &RequestFeature, _, cx| {
|
||||
cx.open_url(REQUEST_FEATURE_URL);
|
||||
})
|
||||
|
|
@ -96,3 +110,32 @@ pub fn init(cx: &mut App) {
|
|||
})
|
||||
.detach();
|
||||
}
|
||||
|
||||
fn format_installed_extensions_for_clipboard(cx: &mut App) -> String {
|
||||
let store = ExtensionStore::global(cx);
|
||||
let store = store.read(cx);
|
||||
let mut lines = Vec::with_capacity(store.extension_index.extensions.len());
|
||||
|
||||
for (extension_id, entry) in store.extension_index.extensions.iter() {
|
||||
let line = format!(
|
||||
"- {} ({}) v{}{}",
|
||||
entry.manifest.name,
|
||||
extension_id,
|
||||
entry.manifest.version,
|
||||
if entry.dev { " (dev)" } else { "" }
|
||||
);
|
||||
lines.push(line);
|
||||
}
|
||||
|
||||
lines.sort();
|
||||
|
||||
if lines.is_empty() {
|
||||
return "No extensions installed.".to_string();
|
||||
}
|
||||
|
||||
format!(
|
||||
"Installed extensions ({}):\n{}",
|
||||
lines.len(),
|
||||
lines.join("\n")
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ When reporting issues or seeking help, it's useful to know your Zed version and
|
|||
|
||||
- {#action zed::About}: Find your Zed version number
|
||||
- {#action zed::CopySystemSpecsIntoClipboard}: Populate your clipboard with Zed version number, operating system version, and hardware specs
|
||||
- {#action zed::CopyInstalledExtensionsIntoClipboard}: Populate your clipboard with a list of your installed extensions and versions
|
||||
|
||||
## Zed Log
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue