Skip to content

Commit

Permalink
remove arbitrary 600 pixel limit on quick input widget
Browse files Browse the repository at this point in the history
  • Loading branch information
usr-org committed Feb 4, 2023
1 parent b859044 commit 6bc37f3
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/stable-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
shell: bash
env:
VSCODE_ARCH: ${{ matrix.vscode_arch }}
# - get_repo.sh
RELEASE_VERSION: 1.75.0
MS_TAG: 1.75.0
MS_COMMIT: e2816fe719a4026ffa1ee0189dc89bdfdbafb164
strategy:
fail-fast: false
matrix:
Expand Down
83 changes: 83 additions & 0 deletions patches/user/1.75.0...usr-org:vscode:usr-org.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
diff --git a/src/vs/base/parts/quickinput/browser/quickInput.ts b/src/vs/base/parts/quickinput/browser/quickInput.ts
index 0ca65b8e40db3..80924b5c661ef 100644
--- a/src/vs/base/parts/quickinput/browser/quickInput.ts
+++ b/src/vs/base/parts/quickinput/browser/quickInput.ts
@@ -39,6 +39,8 @@ export interface IQuickInputOptions {
idPrefix: string;
container: HTMLElement;
ignoreFocusOut(): boolean;
+ maximumWidth(): number;
+ relativeWidth(): number;
isScreenReaderOptimized(): boolean;
backKeybindingLabel(): string | undefined;
setContextKey(id?: string): void;
@@ -1215,7 +1217,7 @@ class InputBox extends QuickInput implements IInputBox {
}

export class QuickInputController extends Disposable {
- private static readonly MAX_WIDTH = 600; // Max total width of quick input widget
+ //private static readonly MAX_WIDTH = 600; // Max total width of quick input widget

private idPrefix: string;
private ui: QuickInputUI | undefined;
@@ -1813,7 +1815,8 @@ export class QuickInputController extends Disposable {
this.ui.container.style.top = `${this.titleBarOffset}px`;

const style = this.ui.container.style;
- const width = Math.min(this.dimension!.width * 0.62 /* golden cut */, QuickInputController.MAX_WIDTH);
+ //const width = Math.min(this.dimension!.width * 0.62 /* golden cut */, QuickInputController.MAX_WIDTH);
+ const width = Math.min(this.dimension!.width * this.options.relativeWidth(), this.options.maximumWidth());
style.width = width + 'px';

this.ui.inputBox.layout();
diff --git a/src/vs/platform/quickinput/browser/quickInput.ts b/src/vs/platform/quickinput/browser/quickInput.ts
index b318044c2f696..a9d85b1a377a2 100644
--- a/src/vs/platform/quickinput/browser/quickInput.ts
+++ b/src/vs/platform/quickinput/browser/quickInput.ts
@@ -71,6 +71,8 @@ export class QuickInputService extends Themable implements IQuickInputService {
idPrefix: 'quickInput_', // Constant since there is still only one.
container: host.container,
ignoreFocusOut: () => false,
+ maximumWidth: () => 600,
+ relativeWidth: () => 0.62,
isScreenReaderOptimized: () => this.accessibilityService.isScreenReaderOptimized(),
backKeybindingLabel: () => undefined,
setContextKey: (id?: string) => this.setContextKey(id),
diff --git a/src/vs/workbench/browser/workbench.contribution.ts b/src/vs/workbench/browser/workbench.contribution.ts
index 4ea06cce5ed9b..97c4dd5bf8ea1 100644
--- a/src/vs/workbench/browser/workbench.contribution.ts
+++ b/src/vs/workbench/browser/workbench.contribution.ts
@@ -348,6 +348,20 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
'description': localize('workbench.quickOpen.preserveInput', "Controls whether the last typed input to Quick Open should be restored when opening it the next time."),
'default': false
},
+ 'workbench.quickOpen.maximumWidth': {
+ 'type': 'number',
+ 'description': localize('workbench.quickOpen.maxWidth', "Limits the maximum width of the quick open widget to the specified number of pixels."),
+ 'default': 600,
+ 'minimum': 200,
+ 'maximum': 2000
+ },
+ 'workbench.quickOpen.relativeWidth': {
+ 'type': 'number',
+ 'description': localize('workbench.quickOpen.relativeWidth', "Controls the width of the quick open widget relative to the total window width."),
+ 'default': 0.62,
+ 'minimum': 0.1,
+ 'maximum': 1.0
+ },
'workbench.settings.openDefaultSettings': {
'type': 'boolean',
'description': localize('openDefaultSettings', "Controls whether opening settings also opens an editor showing all default settings."),
diff --git a/src/vs/workbench/services/quickinput/browser/quickInputService.ts b/src/vs/workbench/services/quickinput/browser/quickInputService.ts
index 34572df63e0f1..1779bb11f36b5 100644
--- a/src/vs/workbench/services/quickinput/browser/quickInputService.ts
+++ b/src/vs/workbench/services/quickinput/browser/quickInputService.ts
@@ -41,6 +41,8 @@ export class QuickInputService extends BaseQuickInputService {

protected override createController(): QuickInputController {
return super.createController(this.layoutService, {
+ maximumWidth: () => this.configurationService.getValue('workbench.quickOpen.maximumWidth'),
+ relativeWidth: () => this.configurationService.getValue('workbench.quickOpen.relativeWidth'),
ignoreFocusOut: () => !this.configurationService.getValue('workbench.quickOpen.closeOnFocusLost'),
backKeybindingLabel: () => this.keybindingService.lookupKeybinding('workbench.action.quickInputBack')?.getLabel() || undefined
});

0 comments on commit 6bc37f3

Please sign in to comment.