Skip to content

Commit

Permalink
Add buttons for moving the terminal around. (#2704)
Browse files Browse the repository at this point in the history
* Add buttons for moving the terminal around.

* Add button visibility options.

* Simplified button visibility options.
  • Loading branch information
MartinGC94 authored May 19, 2020
1 parent 252a2c5 commit 78bbb83
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 2 deletions.
56 changes: 54 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
}
Expand Down Expand Up @@ -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."
}
}
},
Expand Down
9 changes: 9 additions & 0 deletions resources/dark/ClosePanel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/dark/MovePanelBottom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/dark/MovePanelLeft.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions resources/light/ClosePanel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/light/MovePanelBottom.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions resources/light/MovePanelLeft.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/features/ISECompatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export interface ISettings {
bugReporting?: IBugReportingSettings;
sideBar?: ISideBarSettings;
pester?: IPesterSettings;
buttons?: IButtonSettings;
}

export interface IStartAsLoginShellSettings {
Expand All @@ -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(
Expand Down Expand Up @@ -192,6 +198,11 @@ export function load(): ISettings {
CommandExplorerVisibility: true,
};

const defaultButtonSettings: IButtonSettings = {
showRunButtons: true,
showPanelMovementButtons: false
};

const defaultPesterSettings: IPesterSettings = {
useLegacyCodeLens: true,
outputVerbosity: "FromPreference",
Expand Down Expand Up @@ -237,6 +248,8 @@ export function load(): ISettings {
configuration.get<ISideBarSettings>("sideBar", defaultSideBarSettings),
pester:
configuration.get<IPesterSettings>("pester", defaultPesterSettings),
buttons:
configuration.get<IButtonSettings>("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
Expand Down

0 comments on commit 78bbb83

Please sign in to comment.