From 5e10e9bbc678cdeb84575b627f281f80f130fc5b Mon Sep 17 00:00:00 2001 From: chouchouji <1305974212@qq.com> Date: Fri, 15 Nov 2024 11:31:22 +0800 Subject: [PATCH] feat: support sorting by alphabet --- README.md | 2 +- package.json | 17 +++++++++++++++++ src/extension.ts | 13 +++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f8de9c6..5cc6b2f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@
A tool used to manage your system aliases
+A vscode extension used to manage your system aliases
diff --git a/package.json b/package.json
index a5c119f..f8eabaf 100644
--- a/package.json
+++ b/package.json
@@ -94,6 +94,10 @@
{
"command": "aliasView.renameGroup",
"title": "Rename Group"
+ },
+ {
+ "command": "aliasView.sortByAlphabet",
+ "title": "Sort By Alphabet"
}
],
"commandPalette": [
@@ -178,6 +182,10 @@
{
"submenu": "groupOperation",
"when": "view == aliasView && (viewItem == alias_child || viewItem == alias_system_child)"
+ },
+ {
+ "submenu": "sortAlias",
+ "when": "view == aliasView && (viewItem == alias_parent || viewItem == alias_system_parent)"
}
],
"groupOperation": [
@@ -188,12 +196,21 @@
{
"command": "aliasView.addToGroup"
}
+ ],
+ "sortAlias": [
+ {
+ "command": "aliasView.sortByAlphabet"
+ }
]
},
"submenus": [
{
"id": "groupOperation",
"label": "Group Operation"
+ },
+ {
+ "id": "sortAlias",
+ "label": "Sort Alias"
}
],
"viewsContainers": {
diff --git a/src/extension.ts b/src/extension.ts
index 5c391f3..5712f22 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -84,6 +84,10 @@ export function activate(context: vscode.ExtensionContext) {
aliasView.removeFromCurrentGroup(alias),
),
);
+
+ context.subscriptions.push(
+ vscode.commands.registerCommand('aliasView.sortByAlphabet', (alias: AliasItem) => aliasView.sortByAlphabet(alias)),
+ );
}
class AliasView implements vscode.TreeDataProvider