提交 8a9ddea7 编写于 作者: J João Moreno

Merge pull request #7141 from joaomoreno/disable-parameter-hints

Allow disabling parameter hints
......@@ -183,6 +183,7 @@ class InternalEditorOptionsHelper {
contextmenu: toBoolean(opts.contextmenu),
quickSuggestions: toBoolean(opts.quickSuggestions),
quickSuggestionsDelay: toInteger(opts.quickSuggestionsDelay),
parameterHints: toBoolean(opts.parameterHints),
iconsInSuggestions: toBoolean(opts.iconsInSuggestions),
formatOnType: toBoolean(opts.formatOnType),
suggestOnTriggerCharacters: toBoolean(opts.suggestOnTriggerCharacters),
......@@ -591,6 +592,11 @@ let editorConfiguration:IConfigurationNode = {
'minimum': 0,
'description': nls.localize('quickSuggestionsDelay', "Controls the delay in ms after which quick suggestions will show up")
},
'editor.parameterHints' : {
'type': 'boolean',
'default': DefaultConfig.editor.parameterHints,
'description': nls.localize('parameterHints', "Enables parameter hints")
},
'editor.autoClosingBrackets' : {
'type': 'boolean',
'default': DefaultConfig.editor.autoClosingBrackets,
......
......@@ -77,6 +77,7 @@ class ConfigClass implements IConfiguration {
mouseWheelScrollSensitivity: 1,
quickSuggestions: true,
quickSuggestionsDelay: 10,
parameterHints: true,
iconsInSuggestions: true,
autoClosingBrackets: true,
formatOnType: false,
......
......@@ -348,6 +348,10 @@ export interface IEditorOptions {
* Defaults to 500 (ms)
*/
quickSuggestionsDelay?:number;
/**
* Enables parameter hints
*/
parameterHints?:boolean;
/**
* Render icons in suggestions box.
* Defaults to true.
......@@ -765,6 +769,7 @@ export class EditorContribOptions {
contextmenu:boolean;
quickSuggestions:boolean;
quickSuggestionsDelay:number;
parameterHints: boolean;
iconsInSuggestions:boolean;
formatOnType:boolean;
suggestOnTriggerCharacters: boolean;
......@@ -783,6 +788,7 @@ export class EditorContribOptions {
contextmenu:boolean;
quickSuggestions:boolean;
quickSuggestionsDelay:number;
parameterHints:boolean;
iconsInSuggestions:boolean;
formatOnType:boolean;
suggestOnTriggerCharacters: boolean;
......@@ -796,7 +802,8 @@ export class EditorContribOptions {
this.hover = Boolean(source.hover);
this.contextmenu = Boolean(source.contextmenu);
this.quickSuggestions = Boolean(source.quickSuggestions);
this.quickSuggestionsDelay = source.quickSuggestionsDelay|0;
this.quickSuggestionsDelay = source.quickSuggestionsDelay||0;
this.parameterHints = Boolean(source.parameterHints);
this.iconsInSuggestions = Boolean(source.iconsInSuggestions);
this.formatOnType = Boolean(source.formatOnType);
this.suggestOnTriggerCharacters = Boolean(source.suggestOnTriggerCharacters);
......@@ -817,6 +824,7 @@ export class EditorContribOptions {
&& this.contextmenu === other.contextmenu
&& this.quickSuggestions === other.quickSuggestions
&& this.quickSuggestionsDelay === other.quickSuggestionsDelay
&& this.parameterHints === other.parameterHints
&& this.iconsInSuggestions === other.iconsInSuggestions
&& this.formatOnType === other.formatOnType
&& this.suggestOnTriggerCharacters === other.suggestOnTriggerCharacters
......
......@@ -37,6 +37,7 @@ export class ParameterHintsModel extends Disposable {
onCancel: Event<void> = this._onCancel.event;
private editor: ICommonCodeEditor;
private enabled: boolean;
private triggerCharactersListeners: IDisposable[];
private active: boolean;
private throttledDelayer: RunOnceScheduler;
......@@ -45,16 +46,20 @@ export class ParameterHintsModel extends Disposable {
super();
this.editor = editor;
this.enabled = false;
this.triggerCharactersListeners = [];
this.throttledDelayer = new RunOnceScheduler(() => this.doTrigger(), ParameterHintsModel.DELAY);
this.active = false;
this._register(this.editor.onDidChangeConfiguration(() => this.onEditorConfigurationChange()));
this._register(this.editor.onDidChangeModel(e => this.onModelChanged()));
this._register(this.editor.onDidChangeModelMode(_ => this.onModelChanged()));
this._register(this.editor.onDidChangeCursorSelection(e => this.onCursorChange(e)));
this._register(SignatureHelpProviderRegistry.onDidChange(this.onModelChanged, this));
this.onEditorConfigurationChange();
this.onModelChanged();
}
......@@ -69,7 +74,7 @@ export class ParameterHintsModel extends Disposable {
}
trigger(delay = ParameterHintsModel.DELAY): void {
if (!SignatureHelpProviderRegistry.has(this.editor.getModel())) {
if (!this.enabled || !SignatureHelpProviderRegistry.has(this.editor.getModel())) {
return;
}
......@@ -130,6 +135,14 @@ export class ParameterHintsModel extends Disposable {
}
}
private onEditorConfigurationChange(): void {
this.enabled = this.editor.getConfiguration().contribInfo.parameterHints;
if (!this.enabled) {
this.cancel();
}
}
dispose(): void {
this.cancel(true);
this.triggerCharactersListeners = dispose(this.triggerCharactersListeners);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册