Skip to content

Commit 99e08fd

Browse files
committed
Provide Run button in Editor Title Menu
This commit adds a editor title menu button for the `powershell.Run` command which maps to the builtin VS Code Debug start command. It places it in the primary navigation group, and the uses `run` icon from the https://github.com/microsoft/vscode-icons repo. This shows the button in the visible part of the menu when a PowerShell file is open.
1 parent 0b34843 commit 99e08fd

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

package.json

+15-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@
161161
},
162162
"category": "PowerShell"
163163
},
164+
{
165+
"command": "PowerShell.Run",
166+
"title": "Run",
167+
"category": "PowerShell",
168+
"icon": {
169+
"light": "resources/light/run.svg",
170+
"dark": "resources/dark/run.svg"
171+
}
172+
},
164173
{
165174
"command": "PowerShell.RunSelection",
166175
"title": "Run Selection",
@@ -267,8 +276,13 @@
267276
"editor/title": [
268277
{
269278
"when": "resourceLangId == powershell",
270-
"command": "PowerShell.RunSelection",
279+
"command": "PowerShell.Run",
271280
"group": "navigation@100"
281+
},
282+
{
283+
"when": "resourceLangId == powershell",
284+
"command": "PowerShell.RunSelection",
285+
"group": "navigation@101"
272286
}
273287
],
274288
"editor/title/context": [

resources/dark/run.svg

+3
Loading

resources/light/run.svg

+3
Loading

src/features/Console.ts

+3
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,9 @@ export class ConsoleFeature implements IFeature {
204204

205205
constructor(private log: Logger) {
206206
this.commands = [
207+
vscode.commands.registerCommand("PowerShell.Run", async () => {
208+
await vscode.commands.executeCommand("workbench.action.debug.start");
209+
}),
207210
vscode.commands.registerCommand("PowerShell.RunSelection", async () => {
208211
if (this.languageClient === undefined) {
209212
this.log.writeAndShowError(`<${ConsoleFeature.name}>: ` +

0 commit comments

Comments
 (0)