Skip to content

Commit

Permalink
Make experimental and clamp numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Nov 5, 2024
1 parent b211f03 commit a05a955
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/vs/workbench/browser/workbench.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,14 +490,14 @@ 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': {
'workbench.quickOpen.experimental.maximumWidth': {
'type': 'number',
'description': localize('workbench.quickOpen.maxWidth', "Limits the maximum width of Quick Open to the specified number of pixels."),
'default': 600,
'minimum': 200,
'maximum': 2000
},
'workbench.quickOpen.relativeWidth': {
'workbench.quickOpen.experimental.relativeWidth': {
'type': 'number',
'description': localize('workbench.quickOpen.relativeWidth', "Controls the width of Quick Open relative to the total window width."),
'default': 0.62,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { QuickInputService as BaseQuickInputService } from '../../../../platform
import { InstantiationType, registerSingleton } from '../../../../platform/instantiation/common/extensions.js';
import { IQuickInputService } from '../../../../platform/quickinput/common/quickInput.js';
import { InQuickPickContextKey } from '../../../browser/quickaccess.js';
import { clamp } from '../../../../base/common/numbers.js';

export class QuickInputService extends BaseQuickInputService {

Expand All @@ -40,8 +41,8 @@ export class QuickInputService extends BaseQuickInputService {
protected override createController(): QuickInputController {
return super.createController(this.layoutService, {
ignoreFocusOut: () => !this.configurationService.getValue('workbench.quickOpen.closeOnFocusLost'),
maximumWidth: () => this.configurationService.getValue('workbench.quickOpen.maximumWidth'),
relativeWidth: () => this.configurationService.getValue('workbench.quickOpen.relativeWidth'),
maximumWidth: () => clamp(this.configurationService.getValue('workbench.quickOpen.experimental.maximumWidth'), 200, 2000),
relativeWidth: () => clamp(this.configurationService.getValue('workbench.quickOpen.experimental.relativeWidth'), 0.5, 0.9),
backKeybindingLabel: () => this.keybindingService.lookupKeybinding('workbench.action.quickInputBack')?.getLabel() || undefined,
});
}
Expand Down

0 comments on commit a05a955

Please sign in to comment.