未验证 提交 5d0eed5f 编写于 作者: A Alex Dima

Expose `diffEditor.codeLens` to VS Code users

上级 37c5b168
......@@ -674,6 +674,12 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
if (typeof newOptions.originalEditable !== 'undefined') {
this._originalIsEditable = Boolean(newOptions.originalEditable);
}
if (typeof newOptions.originalCodeLens !== 'undefined') {
this._originalCodeLens = Boolean(newOptions.originalCodeLens);
}
if (typeof newOptions.modifiedCodeLens !== 'undefined') {
this._modifiedCodeLens = Boolean(newOptions.modifiedCodeLens);
}
this.modifiedEditor.updateOptions(this._adjustOptionsForRightHandSide(newOptions, this._modifiedCodeLens));
this.originalEditor.updateOptions(this._adjustOptionsForLeftHandSide(newOptions, this._originalIsEditable, this._originalCodeLens));
......
......@@ -541,6 +541,11 @@ const editorConfiguration: IConfigurationNode = {
type: 'boolean',
default: true,
description: nls.localize('renderIndicators', "Controls whether the diff editor shows +/- indicators for added/removed changes.")
},
'diffEditor.codeLens': {
type: 'boolean',
default: false,
description: nls.localize('codeLens', "Controls whether the editor shows CodeLens.")
}
}
};
......
......@@ -202,7 +202,16 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
// Handle diff editor specially by merging in diffEditor configuration
if (isObject(configuration.diffEditor)) {
objects.mixin(editorConfiguration, configuration.diffEditor);
// User settings defines `diffEditor.codeLens`, but there is also `editor.codeLens`.
// Due to the mixin, the two settings cannot be distinguished anymore.
//
// So we map `diffEditor.codeLens` to `diffEditor.originalCodeLens` and `diffEditor.modifiedCodeLens`.
const diffEditorConfiguration = <IDiffEditorOptions>objects.deepClone(configuration.diffEditor);
diffEditorConfiguration.originalCodeLens = diffEditorConfiguration.codeLens;
diffEditorConfiguration.modifiedCodeLens = diffEditorConfiguration.codeLens;
delete diffEditorConfiguration.codeLens;
objects.mixin(editorConfiguration, diffEditorConfiguration);
}
return editorConfiguration;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册