Skip to content

Commit

Permalink
Add Open Settings command in the Side Bar (Closes #352)
Browse files Browse the repository at this point in the history
  • Loading branch information
alefragnani committed Nov 13, 2020
1 parent a9493df commit 91806c3
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 1 deletion.
15 changes: 14 additions & 1 deletion package.json
Expand Up @@ -120,6 +120,10 @@
"title": "%bookmarks.commands.refresh.title%",
"icon": "$(refresh)"
},
{
"command": "bookmarks.openSettings",
"title": "%bookmarks.commands.openSettings.title%"
},
{
"command": "bookmarks.clear",
"title": "%bookmarks.commands.clear.title%"
Expand Down Expand Up @@ -174,6 +178,10 @@
"command": "bookmarks.refresh",
"when": "false"
},
{
"command": "bookmarks.openSettings",
"when": "false"
},
{
"command": "_bookmarks.clearFromFile",
"when": "false"
Expand Down Expand Up @@ -236,7 +244,12 @@
"command": "bookmarks.refresh",
"when": "view == bookmarksExplorer",
"group": "navigation@10"
}
},
{
"command": "bookmarks.openSettings",
"when": "view == bookmarksExplorer",
"group": "2_bookmarks"
}
],
"view/item/context": [
{
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Expand Up @@ -12,6 +12,7 @@
"bookmarks.commands.list.title": "Bookmarks: List",
"bookmarks.commands.toggleLabeled.title": "Bookmarks: Toggle Labeled",
"bookmarks.commands.refresh.title": "Refresh",
"bookmarks.commands.openSettings.title": "Open Settings",
"bookmarks.commands.clear.title": "Bookmarks: Clear",
"bookmarks.commands.clearFromFile.title": "Clear",
"bookmarks.commands.deleteBookmark.title": "Delete",
Expand Down
1 change: 1 addition & 0 deletions package.nls.pt-br.json
Expand Up @@ -12,6 +12,7 @@
"bookmarks.commands.list.title": "Bookmarks: Listar",
"bookmarks.commands.toggleLabeled.title": "Bookmarks: Alterar Rotulado",
"bookmarks.commands.refresh.title": "Atualizar",
"bookmarks.commands.openSettings.title": "Abrir Configurações",
"bookmarks.commands.clear.title": "Bookmarks: Limpar",
"bookmarks.commands.clearFromFile.title": "Limpar",
"bookmarks.commands.deleteBookmark.title": "Apagar",
Expand Down
1 change: 1 addition & 0 deletions package.nls.ru.json
Expand Up @@ -12,6 +12,7 @@
"bookmarks.commands.list.title": "Закладки: Список",
"bookmarks.commands.toggleLabeled.title": "Закладки: Переключить маркер",
"bookmarks.commands.refresh.title": "Обновить",
"bookmarks.commands.openSettings.title": "Открыть настройки",
"bookmarks.commands.clear.title": "Закладки: Очистить",
"bookmarks.commands.clearFromFile.title": "Очистить",
"bookmarks.commands.deleteBookmark.title": "Удалить",
Expand Down
1 change: 1 addition & 0 deletions package.nls.zh-cn.json
Expand Up @@ -12,6 +12,7 @@
"bookmarks.commands.list.title": "书签: 列表",
"bookmarks.commands.toggleLabeled.title": "书签: 开关标记",
"bookmarks.commands.refresh.title": "刷新",
"bookmarks.commands.openSettings.title": "打开设置",
"bookmarks.commands.clear.title": "书签: 清空",
"bookmarks.commands.clearFromFile.title": "清空",
"bookmarks.commands.deleteBookmark.title": "删除",
Expand Down
13 changes: 13 additions & 0 deletions src/commands/openSettings.ts
@@ -0,0 +1,13 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Alessandro Fragnani. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { commands } from "vscode";
import { Container } from "../../vscode-bookmarks-core/src/container";

export function registerOpenSettings() {
Container.context.subscriptions.push(commands.registerCommand("bookmarks.openSettings", async () => {
commands.executeCommand("workbench.action.openSettings", "bookmarks");
}));
}
2 changes: 2 additions & 0 deletions src/extension.ts
Expand Up @@ -17,6 +17,7 @@ import { BookmarksExplorer } from "../vscode-bookmarks-core/src/sidebar/bookmark
import { parsePosition, Point } from "../vscode-bookmarks-core/src/sidebar/parser";
import { Sticky } from "../vscode-bookmarks-core/src/sticky/sticky";
import { suggestLabel, useSelectionWhenAvailable } from "../vscode-bookmarks-core/src/suggestion";
import { registerOpenSettings } from "./commands/openSettings";
import { registerSupportBookmarks } from "./commands/supportBookmarks";
import { registerHelpAndFeedbackView } from "./sidebar/helpAndFeedbackView";
import { registerWhatsNew } from "./whats-new/commands";
Expand Down Expand Up @@ -47,6 +48,7 @@ export function activate(context: vscode.ExtensionContext) {
const bookmarkExplorer = new BookmarksExplorer(bookmarks, context);
const bookmarkProvider = bookmarkExplorer.getProvider();

registerOpenSettings();
registerSupportBookmarks();
registerHelpAndFeedbackView(context);
// bookmarkProvider.showTreeView();
Expand Down

0 comments on commit 91806c3

Please sign in to comment.