Skip to content

Commit

Permalink
feat(bookmark-group): 增加分组功能(WIP),并重构命令注册部分
Browse files Browse the repository at this point in the history
  • Loading branch information
czfadmin committed Apr 4, 2024
1 parent e0bc469 commit f1d283a
Show file tree
Hide file tree
Showing 27 changed files with 2,493 additions and 1,953 deletions.
58 changes: 29 additions & 29 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,33 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "tasks: watch-tests"
}
]
"version": "0.2.0",
"configurations": [
{
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": ["${workspaceFolder}/dist/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
},
{
"name": "Extension Tests",
"type": "extensionHost",
"request": "launch",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test/suite/index"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js",
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "tasks: watch-tests"
}
]
}
71 changes: 70 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,41 @@
"command": "bookmark-manager.groupedByWorkspace",
"title": "%bookmark-manager.groupedByWorkspace%",
"category": "Bookmark Manager (BM)"
},
{
"command": "bookmark-manager.groupedByCustom",
"title": "%bookmark-manager.groupedByCustom%",
"category": "Bookmark Manager (BM)"
},
{
"command": "bookmark-manager.addBookmarkGroup",
"title": "%bookmark-manager.addBookmarkGroup%",
"icon": "$(new-folder)",
"category": "Bookmark Manager (BM)"
},
{
"command": "bookmark-manager.chanegBookmarkGroupLabel",
"title": "%bookmark-manager.chanegBookmarkGroupLabel%",
"icon": "$(notebook-edit)",
"category": "Bookmark Manager (BM)"
},
{
"command": "bookmark-manager.deleteBookmarkGroup",
"title": "%bookmark-manager.deleteBookmarkGroup%",
"icon": "$(bookmark)",
"category": "Bookmark Manager (BM)"
},
{
"command": "bookmark-manager.changeBookmarkGroupColor",
"title": "%bookmark-manager.changeBookmarkGroupColor%",
"icon": "$(bookmark)",
"category": "Bookmark Manager (BM)"
},
{
"command": "bookmark-manager.clearAllBookmarksInGroup",
"title": "%bookmark-manager.clearAllBookmarksInGroup%",
"icon": "$(clear-all)",
"category": "Bookmark Manager (BM)"
}
],
"views": {
Expand Down Expand Up @@ -433,13 +468,23 @@
"command": "bookmark-manager.groupedByColor",
"group": "group@2"
},
{
"command": "bookmark-manager.groupedByCustom",
"group": "group@3"
},
{
"command": "bookmark-manager.groupedByWorkspace",
"when": "view == bookmark-manager && bookmark-manager.multiRootWorkspaces",
"group": "group@3"
"group": "group@4"
}
],
"view/title": [
{
"command": "bookmark-manager.addBookmarkGroup",
"title": "%bookmark-manager.addBookmarkGroup%",
"when": "view == bookmark-manager || view == bookmark-manager.universal",
"group": "navigation@1"
},
{
"command": "bookmark-manager.viewAsTree",
"when": "view == bookmark-manager && !bookmark-manager.code.viewAsTree",
Expand Down Expand Up @@ -530,6 +575,26 @@
"command": "bookmark-manager.deleteUniversalBookmark",
"when": "view == bookmark-manager.universal",
"group": "inline@3"
},
{
"command": "bookmark-manager.chanegBookmarkGroupLabel",
"when": "view == bookmark-manager && viewItem === custom",
"group": "inline@1"
},
{
"command": "bookmark-manager.clearAllBookmarksInGroup",
"when": "view == bookmark-manager && viewItem === custom",
"group": "inline@2"
},
{
"command": "bookmark-manager.changeBookmarkGroupColor",
"when": "view == bookmark-manager && viewItem === custom && false",
"group": "itemContextGroup@2"
},
{
"command": "bookmark-manager.deleteBookmarkGroup",
"when": "view == bookmark-manager && viewItem === custom",
"group": "itemContextGroup@1"
}
],
"commandPalette": [
Expand Down Expand Up @@ -557,6 +622,10 @@
"command": "bookmark-manager.groupedByDefault",
"when": "false"
},
{
"command": "bookmark-manager.groupedByWorkspace",
"when": "bookmark-manager.multiRootWorkspaces"
},
{
"command": "bookmark-manager.groupedByWorkspace",
"when": "bookmark-manager.multiRootWorkspaces"
Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
updateFilesRenameAndDeleteListeners,
updateTextEditorSelectionListener,
} from './events';
import {registerCodeCommands, registerUniversalCommands} from './commands';
import {registerTelemetryLogger} from './utils';
import logger from './utils/logger';

Expand All @@ -22,6 +21,8 @@ import {
postInitController,
} from './services/ServiceManager';

import registerAllBookmarksCommands from './commands';

let controllerManager: {
bookmarks?: BookmarksController;
universal?: UniversalBookmarkController;
Expand All @@ -41,9 +42,8 @@ function registerAllTreeView(context: ExtensionContext) {
/**
* 注册所有的命令
*/
function registerAllCommands() {
registerCodeCommands();
registerUniversalCommands();
function registerAllCommands(context: ExtensionContext) {
registerAllBookmarksCommands(context);
}

/**
Expand Down Expand Up @@ -84,7 +84,7 @@ export default async function bootstrap(context: ExtensionContext) {
initialController(context, sm);
postInitController();
registerAllTreeView(context);
registerAllCommands();
registerAllCommands(context);
updateEverything();
} catch (error) {
console.error(error);
Expand Down
Loading

0 comments on commit f1d283a

Please sign in to comment.