From 898c409ddf16a13f10f41945fe1ede6858b6fcc3 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Mon, 29 Aug 2022 11:17:12 -0400 Subject: [PATCH 1/4] chore: register new command --- packages/plugin-core/package.json | 16 +--------------- packages/plugin-core/src/constants.ts | 4 ++++ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/plugin-core/package.json b/packages/plugin-core/package.json index e46154675c..ab4ed4e65b 100644 --- a/packages/plugin-core/package.json +++ b/packages/plugin-core/package.json @@ -53,10 +53,6 @@ { "view": "dendron.recent-workspaces", "contents": "No recent workspaces detected. If this is your first time using Dendron, [try out our tutorial workspace](command:dendron.launchTutorialWorkspace?%7B%22invocationPoint%22%3A%22RecentWorkspacesPanel%22%7D)." - }, - { - "view": "dendron.treeView", - "contents": "Open a Dendron note to see the tree view." } ], "viewsContainers": { @@ -829,7 +825,7 @@ }, { "command": "dendron.copyNoteURL", - "when": "dendron:pluginActive" + "when": "dendron:pluginActive && shellExecutionSupported" }, { "command": "dendron.createHook", @@ -1113,16 +1109,6 @@ "when": "resourceLangId == markdown && dendron:pluginActive && shellExecutionSupported", "group": "1_open" } - ], - "view/item/context": [ - { - "command": "dendron.delete", - "when": "view == dendron.treeView && viewItem == note" - }, - { - "command": "dendron.createNote", - "when": "view == dendron.treeView" - } ] }, "configuration": { diff --git a/packages/plugin-core/src/constants.ts b/packages/plugin-core/src/constants.ts index fffe4701d6..baf98137c4 100644 --- a/packages/plugin-core/src/constants.ts +++ b/packages/plugin-core/src/constants.ts @@ -1051,6 +1051,10 @@ export const DENDRON_COMMANDS: { [key: string]: CommandEntry } = { title: `${CMD_PREFIX}Dev: Validate Engine`, when: `${DendronContext.PLUGIN_ACTIVE} && shellExecutionSupported`, }, + SHOW_INFO: { + key: "dendron.showInfo", + title: `${CMD_PREFIX}: Show Info`, + }, }; export const DENDRON_CHANNEL_NAME = "Dendron"; From f9edac0eeb64b509a9f93ff52c3910171287b534 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Mon, 29 Aug 2022 14:47:14 -0400 Subject: [PATCH 2/4] chore: add new cmd --- packages/plugin-core/src/commands/ShowInfo.ts | 24 +++++++++++++++++++ packages/plugin-core/src/commands/index.ts | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 packages/plugin-core/src/commands/ShowInfo.ts diff --git a/packages/plugin-core/src/commands/ShowInfo.ts b/packages/plugin-core/src/commands/ShowInfo.ts new file mode 100644 index 0000000000..af4410c8d6 --- /dev/null +++ b/packages/plugin-core/src/commands/ShowInfo.ts @@ -0,0 +1,24 @@ +import { env, Uri } from "vscode"; +import { DENDRON_COMMANDS } from "../constants"; +import { BasicCommand } from "./base"; + +type CommandOpts = {}; + +type CommandInput = {}; + +type CommandOutput = void; + +export class ShowInfo extends BasicCommand { + key = DENDRON_COMMANDS.SHOW_INFO.key; + async gatherInputs(): Promise { + return {}; + } + async execute() { + console.log("new command being executed"); + // env.openExternal( + // Uri.parse( + // "https://www.dendron.so/notes/f9540bb6-7a5a-46db-ae7c-e1a606f28c73.html" + // ) + // ); + } +} diff --git a/packages/plugin-core/src/commands/index.ts b/packages/plugin-core/src/commands/index.ts index 0e03504a33..6087df200b 100644 --- a/packages/plugin-core/src/commands/index.ts +++ b/packages/plugin-core/src/commands/index.ts @@ -85,6 +85,7 @@ import { VaultRemoveCommand } from "./VaultRemoveCommand"; import { RenameNoteCommand } from "./RenameNoteCommand"; import { CreateNoteCommand } from "./CreateNoteCommand"; import { MergeNoteCommand } from "./MergeNoteCommand"; +import { ShowInfo } from "./ShowInfo"; /** * Note: this does not contain commands that have parametered constructors, as @@ -177,6 +178,7 @@ const ALL_COMMANDS = [ ValidateEngineCommand, MergeNoteCommand, CreateNoteCommand, + ShowInfo, ] as CodeCommandConstructor[]; export { ALL_COMMANDS }; From 2ed11ebdd0822addf1c22e4ad2bc0ef7e869ca32 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Mon, 29 Aug 2022 15:02:54 -0400 Subject: [PATCH 3/4] chore: remove unnecessary imports --- packages/plugin-core/src/commands/ShowInfo.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/plugin-core/src/commands/ShowInfo.ts b/packages/plugin-core/src/commands/ShowInfo.ts index af4410c8d6..d671dd017f 100644 --- a/packages/plugin-core/src/commands/ShowInfo.ts +++ b/packages/plugin-core/src/commands/ShowInfo.ts @@ -1,4 +1,3 @@ -import { env, Uri } from "vscode"; import { DENDRON_COMMANDS } from "../constants"; import { BasicCommand } from "./base"; From e4140164db762673e9919806242d23316bb6ad67 Mon Sep 17 00:00:00 2001 From: Hayata Suenaga <98560306+hayata-suenaga@users.noreply.github.com> Date: Mon, 29 Aug 2022 15:03:15 -0400 Subject: [PATCH 4/4] chore: update config file --- packages/plugin-core/package.json | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/plugin-core/package.json b/packages/plugin-core/package.json index ab4ed4e65b..9df9e8f5e1 100644 --- a/packages/plugin-core/package.json +++ b/packages/plugin-core/package.json @@ -53,6 +53,10 @@ { "view": "dendron.recent-workspaces", "contents": "No recent workspaces detected. If this is your first time using Dendron, [try out our tutorial workspace](command:dendron.launchTutorialWorkspace?%7B%22invocationPoint%22%3A%22RecentWorkspacesPanel%22%7D)." + }, + { + "view": "dendron.treeView", + "contents": "First open a Dendron note to see the tree view." } ], "viewsContainers": { @@ -595,6 +599,10 @@ { "command": "dendron.dev.validateEngine", "title": "Dendron:Dev: Validate Engine" + }, + { + "command": "dendron.showInfo", + "title": "Dendron:: Show Info" } ], "menus": { @@ -825,7 +833,7 @@ }, { "command": "dendron.copyNoteURL", - "when": "dendron:pluginActive && shellExecutionSupported" + "when": "dendron:pluginActive" }, { "command": "dendron.createHook", @@ -1109,6 +1117,16 @@ "when": "resourceLangId == markdown && dendron:pluginActive && shellExecutionSupported", "group": "1_open" } + ], + "view/item/context": [ + { + "command": "dendron.delete", + "when": "view == dendron.treeView && viewItem == note" + }, + { + "command": "dendron.createNote", + "when": "view == dendron.treeView" + } ] }, "configuration": {