Merge 07ddd8a19b
into 7dfcd74e63
This commit is contained in:
commit
20820e05d6
|
@ -38,6 +38,8 @@ export interface IQuickInputOptions {
|
|||
idPrefix: string;
|
||||
container: HTMLElement;
|
||||
ignoreFocusOut(): boolean;
|
||||
maximumWidth(): number;
|
||||
relativeWidth(): number;
|
||||
isScreenReaderOptimized(): boolean;
|
||||
backKeybindingLabel(): string | undefined;
|
||||
setContextKey(id?: string): void;
|
||||
|
@ -1159,8 +1161,6 @@ 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 idPrefix: string;
|
||||
private ui: QuickInputUI | undefined;
|
||||
private dimension?: dom.IDimension;
|
||||
|
@ -1749,7 +1749,7 @@ 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 * this.options.relativeWidth(), this.options.maximumWidth());
|
||||
style.width = width + 'px';
|
||||
style.marginLeft = '-' + (width / 2) + 'px';
|
||||
|
||||
|
|
|
@ -65,6 +65,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),
|
||||
|
|
|
@ -266,6 +266,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."),
|
||||
|
|
|
@ -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,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue