From 78bbb83d201d9892f36aae0291d6dd158d27c663 Mon Sep 17 00:00:00 2001
From: MartinGC94 <42123497+MartinGC94@users.noreply.github.com>
Date: Tue, 19 May 2020 19:29:01 +0200
Subject: [PATCH] Add buttons for moving the terminal around. (#2704)
* Add buttons for moving the terminal around.
* Add button visibility options.
* Simplified button visibility options.
---
package.json | 56 +++++++++++++++++++++++++++--
resources/dark/ClosePanel.svg | 9 +++++
resources/dark/MovePanelBottom.svg | 10 ++++++
resources/dark/MovePanelLeft.svg | 10 ++++++
resources/light/ClosePanel.svg | 9 +++++
resources/light/MovePanelBottom.svg | 10 ++++++
resources/light/MovePanelLeft.svg | 10 ++++++
src/features/ISECompatibility.ts | 1 +
src/settings.ts | 13 +++++++
9 files changed, 126 insertions(+), 2 deletions(-)
create mode 100644 resources/dark/ClosePanel.svg
create mode 100644 resources/dark/MovePanelBottom.svg
create mode 100644 resources/dark/MovePanelLeft.svg
create mode 100644 resources/light/ClosePanel.svg
create mode 100644 resources/light/MovePanelBottom.svg
create mode 100644 resources/light/MovePanelLeft.svg
diff --git a/package.json b/package.json
index 4ef930e51e..43d7f069e4 100644
--- a/package.json
+++ b/package.json
@@ -265,6 +265,33 @@
"command": "PowerShell.InvokeRegisteredEditorCommand",
"title": "Invoke Registered Editor Command",
"category": "PowerShell"
+ },
+ {
+ "command": "workbench.action.closePanel",
+ "title": "Close panel",
+ "category": "PowerShell",
+ "icon": {
+ "light": "resources/light/ClosePanel.svg",
+ "dark": "resources/dark/ClosePanel.svg"
+ }
+ },
+ {
+ "command": "workbench.action.positionPanelLeft",
+ "title": "Move panel left",
+ "category": "PowerShell",
+ "icon": {
+ "light": "resources/light/MovePanelLeft.svg",
+ "dark": "resources/dark/MovePanelLeft.svg"
+ }
+ },
+ {
+ "command": "workbench.action.positionPanelBottom",
+ "title": "Move panel to bottom",
+ "category": "PowerShell",
+ "icon": {
+ "light": "resources/light/MovePanelBottom.svg",
+ "dark": "resources/dark/MovePanelBottom.svg"
+ }
}
],
"menus": {
@@ -306,12 +333,27 @@
],
"editor/title": [
{
- "when": "editorLangId == powershell",
+ "when": "editorLangId == powershell && config.powershell.buttons.showPanelMovementButtons",
+ "command": "workbench.action.positionPanelBottom",
+ "group": "navigation@97"
+ },
+ {
+ "when": "editorLangId == powershell && config.powershell.buttons.showPanelMovementButtons",
+ "command": "workbench.action.positionPanelLeft",
+ "group": "navigation@98"
+ },
+ {
+ "when": "editorLangId == powershell && config.powershell.buttons.showPanelMovementButtons",
+ "command": "workbench.action.closePanel",
+ "group": "navigation@99"
+ },
+ {
+ "when": "editorLangId == powershell && config.powershell.buttons.showRunButtons",
"command": "workbench.action.debug.start",
"group": "navigation@100"
},
{
- "when": "editorLangId == powershell",
+ "when": "editorLangId == powershell && config.powershell.buttons.showRunButtons",
"command": "PowerShell.RunSelection",
"group": "navigation@101"
}
@@ -800,6 +842,16 @@
],
"default": "Diagnostic",
"description": "Defines the verbosity of output to be used when debugging a test or a block. For Pester 5 and newer the default value Diagnostic will print additional information about discovery, skipped and filtered tests, mocking and more."
+ },
+ "powershell.buttons.showRunButtons": {
+ "type": "boolean",
+ "default": true,
+ "description": "Show the Run and Run Selection buttons in the editor titlebar."
+ },
+ "powershell.buttons.showPanelMovementButtons": {
+ "type": "boolean",
+ "default": false,
+ "description": "Show buttons in the editor titlebar for moving the panel around."
}
}
},
diff --git a/resources/dark/ClosePanel.svg b/resources/dark/ClosePanel.svg
new file mode 100644
index 0000000000..2feafe7c06
--- /dev/null
+++ b/resources/dark/ClosePanel.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/resources/dark/MovePanelBottom.svg b/resources/dark/MovePanelBottom.svg
new file mode 100644
index 0000000000..8284a0976d
--- /dev/null
+++ b/resources/dark/MovePanelBottom.svg
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/resources/dark/MovePanelLeft.svg b/resources/dark/MovePanelLeft.svg
new file mode 100644
index 0000000000..d7f7797e4c
--- /dev/null
+++ b/resources/dark/MovePanelLeft.svg
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/resources/light/ClosePanel.svg b/resources/light/ClosePanel.svg
new file mode 100644
index 0000000000..5db309662e
--- /dev/null
+++ b/resources/light/ClosePanel.svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/resources/light/MovePanelBottom.svg b/resources/light/MovePanelBottom.svg
new file mode 100644
index 0000000000..739c933e30
--- /dev/null
+++ b/resources/light/MovePanelBottom.svg
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/resources/light/MovePanelLeft.svg b/resources/light/MovePanelLeft.svg
new file mode 100644
index 0000000000..06c569437b
--- /dev/null
+++ b/resources/light/MovePanelLeft.svg
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/src/features/ISECompatibility.ts b/src/features/ISECompatibility.ts
index 6bdf3f1edf..4e8d8d07dc 100644
--- a/src/features/ISECompatibility.ts
+++ b/src/features/ISECompatibility.ts
@@ -24,6 +24,7 @@ export class ISECompatibilityFeature implements IFeature {
{ path: "powershell.integratedConsole", name: "focusConsoleOnExecute", value: false },
{ path: "files", name: "defaultLanguage", value: "powershell" },
{ path: "workbench", name: "colorTheme", value: "PowerShell ISE" },
+ { path: "powershell.buttons", name: "showPanelMovementButtons", value: true }
];
private iseCommandRegistration: vscode.Disposable;
private defaultCommandRegistration: vscode.Disposable;
diff --git a/src/settings.ts b/src/settings.ts
index 00c98f326f..defbdd9e7a 100644
--- a/src/settings.ts
+++ b/src/settings.ts
@@ -100,6 +100,7 @@ export interface ISettings {
bugReporting?: IBugReportingSettings;
sideBar?: ISideBarSettings;
pester?: IPesterSettings;
+ buttons?: IButtonSettings;
}
export interface IStartAsLoginShellSettings {
@@ -125,6 +126,11 @@ export interface IPesterSettings {
debugOutputVerbosity?: string;
}
+export interface IButtonSettings {
+ showRunButtons?: boolean;
+ showPanelMovementButtons?: boolean;
+}
+
export function load(): ISettings {
const configuration: vscode.WorkspaceConfiguration =
vscode.workspace.getConfiguration(
@@ -192,6 +198,11 @@ export function load(): ISettings {
CommandExplorerVisibility: true,
};
+ const defaultButtonSettings: IButtonSettings = {
+ showRunButtons: true,
+ showPanelMovementButtons: false
+ };
+
const defaultPesterSettings: IPesterSettings = {
useLegacyCodeLens: true,
outputVerbosity: "FromPreference",
@@ -237,6 +248,8 @@ export function load(): ISettings {
configuration.get("sideBar", defaultSideBarSettings),
pester:
configuration.get("pester", defaultPesterSettings),
+ buttons:
+ configuration.get("buttons", defaultButtonSettings),
startAsLoginShell:
// tslint:disable-next-line
// We follow the same convention as VS Code - https://github.com/microsoft/vscode/blob/ff00badd955d6cfcb8eab5f25f3edc86b762f49f/src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts#L105-L107