add new setting editor.codeLens and deprecate the old editor.referenceInfos settings, #10238

This commit is contained in:
Johannes Rieken 2016-08-09 15:13:06 +02:00
parent 655efbc2bf
commit b1ddc1ac5e
6 changed files with 21 additions and 15 deletions

View file

@ -852,7 +852,7 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif
clonedOptions.scrollbar = clonedOptions.scrollbar || {};
clonedOptions.scrollbar.vertical = 'visible';
clonedOptions.folding = false;
clonedOptions.referenceInfos = false;
clonedOptions.codeLens = false;
return clonedOptions;
}

View file

@ -265,7 +265,7 @@ class InternalEditorOptionsHelper {
tabCompletion: opts.tabCompletion,
wordBasedSuggestions: opts.wordBasedSuggestions,
selectionHighlight: toBoolean(opts.selectionHighlight),
referenceInfos: toBoolean(opts.referenceInfos),
codeLens: opts.referenceInfos && opts.codeLens,
folding: toBoolean(opts.folding),
});
@ -762,10 +762,10 @@ let editorConfiguration:IConfigurationNode = {
default: DefaultConfig.editor.renderIndentGuides,
description: nls.localize('renderIndentGuides', "Controls whether the editor should render indent guides")
},
'editor.referenceInfos' : {
'editor.codeLens' : {
'type': 'boolean',
'default': DefaultConfig.editor.referenceInfos,
'description': nls.localize('referenceInfos', "Controls if the editor shows reference information for the modes that support it")
'default': DefaultConfig.editor.codeLens,
'description': nls.localize('codeLens', "Controls if the editor shows code lenses")
},
'editor.folding' : {
'type': 'boolean',

View file

@ -87,6 +87,7 @@ class ConfigClass implements IConfiguration {
tabCompletion: false,
wordBasedSuggestions: true,
selectionHighlight: true,
codeLens: true,
referenceInfos: true,
folding: true,
renderWhitespace: false,

View file

@ -408,9 +408,14 @@ export interface IEditorOptions {
*/
selectionHighlight?:boolean;
/**
* Show reference infos (a.k.a. code lenses) for modes that support it
* Show code lens
* Defaults to true.
*/
codeLens?: boolean;
/**
* @deprecated - use codeLens instead
* @internal
*/
referenceInfos?: boolean;
/**
* Enable code folding
@ -815,7 +820,7 @@ export class EditorContribOptions {
tabCompletion: boolean;
wordBasedSuggestions: boolean;
selectionHighlight:boolean;
referenceInfos: boolean;
codeLens: boolean;
folding: boolean;
/**
@ -836,7 +841,7 @@ export class EditorContribOptions {
tabCompletion: boolean;
wordBasedSuggestions: boolean;
selectionHighlight:boolean;
referenceInfos: boolean;
codeLens: boolean;
folding: boolean;
}) {
this.selectionClipboard = Boolean(source.selectionClipboard);
@ -853,7 +858,7 @@ export class EditorContribOptions {
this.tabCompletion = source.tabCompletion;
this.wordBasedSuggestions = source.wordBasedSuggestions;
this.selectionHighlight = Boolean(source.selectionHighlight);
this.referenceInfos = Boolean(source.referenceInfos);
this.codeLens = Boolean(source.codeLens);
this.folding = Boolean(source.folding);
}
@ -876,7 +881,7 @@ export class EditorContribOptions {
&& this.tabCompletion === other.tabCompletion
&& this.wordBasedSuggestions === other.wordBasedSuggestions
&& this.selectionHighlight === other.selectionHighlight
&& this.referenceInfos === other.referenceInfos
&& this.codeLens === other.codeLens
&& this.folding === other.folding
);
}

View file

@ -354,7 +354,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
@ICommandService private _commandService: ICommandService,
@IMessageService private _messageService: IMessageService
) {
this._isEnabled = this._editor.getConfiguration().contribInfo.referenceInfos;
this._isEnabled = this._editor.getConfiguration().contribInfo.codeLens;
this._globalToDispose = [];
this._localToDispose = [];
@ -366,7 +366,7 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
this._globalToDispose.push(this._editor.onDidChangeModelMode(() => this.onModelChange()));
this._globalToDispose.push(this._editor.onDidChangeConfiguration((e: editorCommon.IConfigurationChangedEvent) => {
let prevIsEnabled = this._isEnabled;
this._isEnabled = this._editor.getConfiguration().contribInfo.referenceInfos;
this._isEnabled = this._editor.getConfiguration().contribInfo.codeLens;
if (prevIsEnabled !== this._isEnabled) {
this.onModelChange();
}

6
src/vs/monaco.d.ts vendored
View file

@ -1262,10 +1262,10 @@ declare module monaco.editor {
*/
selectionHighlight?: boolean;
/**
* Show reference infos (a.k.a. code lenses) for modes that support it
* Show code lens
* Defaults to true.
*/
referenceInfos?: boolean;
codeLens?: boolean;
/**
* Enable code folding
* Defaults to true.
@ -1422,7 +1422,7 @@ declare module monaco.editor {
tabCompletion: boolean;
wordBasedSuggestions: boolean;
selectionHighlight: boolean;
referenceInfos: boolean;
codeLens: boolean;
folding: boolean;
}