diff --git a/src/vs/editor/common/config/commonEditorConfig.ts b/src/vs/editor/common/config/commonEditorConfig.ts index 33a9a433690ea4afa07480c93374cc5bee8650fb..8b39ee0f2497d24984a6815420edde3517320c02 100644 --- a/src/vs/editor/common/config/commonEditorConfig.ts +++ b/src/vs/editor/common/config/commonEditorConfig.ts @@ -684,6 +684,11 @@ const editorConfiguration: IConfigurationNode = { 'default': EDITOR_DEFAULTS.contribInfo.codeLens, 'description': nls.localize('codeLens', "Controls whether the editor shows CodeLens") }, + 'editor.cycleParameterHints': { + 'type': 'boolean', + 'default': EDITOR_DEFAULTS.contribInfo.cycleParameterHints, + 'description': nls.localize('cycleParameterHints', "Controls whether the parameter hints menu cycles or closes when reaching the end of the list.") + }, 'editor.folding': { 'type': 'boolean', 'default': EDITOR_DEFAULTS.contribInfo.folding, diff --git a/src/vs/editor/common/config/editorOptions.ts b/src/vs/editor/common/config/editorOptions.ts index 14365ee992523d78e57b525961b04a2c811c0248..902d02abf793fbc3c5bcb510cc99ae2332092602 100644 --- a/src/vs/editor/common/config/editorOptions.ts +++ b/src/vs/editor/common/config/editorOptions.ts @@ -416,6 +416,11 @@ export interface IEditorOptions { * Defaults to true. */ contextmenu?: boolean; + /** + * Enable cycling through parameter hints. + * Defaults to false. + */ + cycleParameterHints?: boolean; /** * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events. * Defaults to 1. @@ -909,6 +914,7 @@ export interface EditorContribOptions { readonly hover: InternalEditorHoverOptions; readonly links: boolean; readonly contextmenu: boolean; + readonly cycleParameterHints: boolean; readonly quickSuggestions: boolean | { other: boolean, comments: boolean, strings: boolean }; readonly quickSuggestionsDelay: number; readonly parameterHints: boolean; @@ -1289,6 +1295,7 @@ export class InternalEditorOptions { && this._equalsHoverOptions(a.hover, b.hover) && a.links === b.links && a.contextmenu === b.contextmenu + && a.cycleParameterHints === b.cycleParameterHints && InternalEditorOptions._equalsQuickSuggestions(a.quickSuggestions, b.quickSuggestions) && a.quickSuggestionsDelay === b.quickSuggestionsDelay && a.parameterHints === b.parameterHints @@ -1884,6 +1891,7 @@ export class EditorOptionsValidator { hover: this._santizeHoverOpts(opts.hover, defaults.hover), links: _boolean(opts.links, defaults.links), contextmenu: _boolean(opts.contextmenu, defaults.contextmenu), + cycleParameterHints: _boolean(opts.cycleParameterHints, defaults.cycleParameterHints), quickSuggestions: quickSuggestions, quickSuggestionsDelay: _clampedInt(opts.quickSuggestionsDelay, defaults.quickSuggestionsDelay, Constants.MIN_SAFE_SMALL_INTEGER, Constants.MAX_SAFE_SMALL_INTEGER), parameterHints: _boolean(opts.parameterHints, defaults.parameterHints), @@ -1992,6 +2000,7 @@ export class InternalEditorOptionsFactory { hover: opts.contribInfo.hover, links: (accessibilityIsOn ? false : opts.contribInfo.links), // DISABLED WHEN SCREEN READER IS ATTACHED contextmenu: opts.contribInfo.contextmenu, + cycleParameterHints: opts.contribInfo.cycleParameterHints, quickSuggestions: opts.contribInfo.quickSuggestions, quickSuggestionsDelay: opts.contribInfo.quickSuggestionsDelay, parameterHints: opts.contribInfo.parameterHints, @@ -2463,6 +2472,7 @@ export const EDITOR_DEFAULTS: IValidatedEditorOptions = { }, links: true, contextmenu: true, + cycleParameterHints: false, quickSuggestions: { other: true, comments: false, strings: false }, quickSuggestionsDelay: 10, parameterHints: true, diff --git a/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts b/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts index 9a5cfbdb3830ffe2c2682449b08c0f22cdd7257a..0120cb2d5a15727af3a2dd38c14b706b9f741d26 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHintsWidget.ts @@ -476,14 +476,20 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable { next(): boolean { const length = this.hints.signatures.length; const last = (this.currentSignature % length) === (length - 1); + const cycleParameterHints = this.editor.getConfiguration().contribInfo.cycleParameterHints; // If there is only one signature, or we're on last signature of list - if (length < 2 || last) { + if ((length < 2 || last) && !cycleParameterHints) { this.cancel(); return false; } - this.currentSignature++; + if (last && cycleParameterHints) { + this.currentSignature = 0; + } else { + this.currentSignature++; + } + this.render(); return true; } @@ -491,13 +497,20 @@ export class ParameterHintsWidget implements IContentWidget, IDisposable { previous(): boolean { const length = this.hints.signatures.length; const first = this.currentSignature === 0; + const cycleParameterHints = this.editor.getConfiguration().contribInfo.cycleParameterHints; - if (length < 2 || first) { + // If there is only one signature, or we're on first signature of list + if ((length < 2 || first) && !cycleParameterHints) { this.cancel(); return false; } - this.currentSignature--; + if (first && cycleParameterHints) { + this.currentSignature = length - 1; + } else { + this.currentSignature--; + } + this.render(); return true; } diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 438105b4d899d3ed6bd3351c7997c86b3e364248..fd79f366e382335851512d47fa4dd50566bd9488 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -2754,6 +2754,11 @@ declare namespace monaco.editor { * Defaults to true. */ contextmenu?: boolean; + /** + * Enable cycling through parameter hints. + * Defaults to false. + */ + cycleParameterHints?: boolean; /** * A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events. * Defaults to 1. @@ -3188,6 +3193,7 @@ declare namespace monaco.editor { readonly hover: InternalEditorHoverOptions; readonly links: boolean; readonly contextmenu: boolean; + readonly cycleParameterHints: boolean; readonly quickSuggestions: boolean | { other: boolean; comments: boolean; diff --git a/src/vs/platform/telemetry/common/telemetryUtils.ts b/src/vs/platform/telemetry/common/telemetryUtils.ts index a68ff28367b54aa2947f691e1f5eb6bcca95046f..9e655dfb6d6ea745a9e368b3717e9a7d8ab00727 100644 --- a/src/vs/platform/telemetry/common/telemetryUtils.ts +++ b/src/vs/platform/telemetry/common/telemetryUtils.ts @@ -113,6 +113,7 @@ const configurationValueWhitelist = [ 'editor.multiCursorModifier', 'editor.quickSuggestions', 'editor.quickSuggestionsDelay', + 'editor.cycleParameterHints', 'editor.parameterHints', 'editor.autoClosingBrackets', 'editor.autoIndent',