Merge from vscode 1b314ab317fbff7d799b21754326b7d849889ceb

This commit is contained in:
ADS Merger
2020-07-15 23:51:18 +00:00
parent aae013d498
commit 9d3f12d0b7
554 changed files with 15159 additions and 8223 deletions

View File

@@ -208,6 +208,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
private _ignoreTrimWhitespace: boolean;
private _originalIsEditable: boolean;
private _originalCodeLens: boolean;
private _modifiedCodeLens: boolean;
private _renderSideBySide: boolean;
private _maxComputationTime: number;
@@ -286,6 +288,16 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._originalIsEditable = Boolean(options.originalEditable);
}
this._originalCodeLens = false;
if (typeof options.originalCodeLens !== 'undefined') {
this._originalCodeLens = Boolean(options.originalCodeLens);
}
this._modifiedCodeLens = false;
if (typeof options.modifiedCodeLens !== 'undefined') {
this._modifiedCodeLens = Boolean(options.modifiedCodeLens);
}
this._updateDecorationsRunner = this._register(new RunOnceScheduler(() => this._updateDecorations(), 0));
this._containerDomElement = document.createElement('div');
@@ -474,7 +486,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
}
private _createLeftHandSideEditor(options: IDiffEditorOptions, instantiationService: IInstantiationService): CodeEditorWidget {
const editor = this._createInnerEditor(instantiationService, this._originalDomNode, this._adjustOptionsForLeftHandSide(options, this._originalIsEditable));
const editor = this._createInnerEditor(instantiationService, this._originalDomNode, this._adjustOptionsForLeftHandSide(options, this._originalIsEditable, this._originalCodeLens));
this._register(editor.onDidScrollChange((e) => {
if (this._isHandlingScrollEvent) {
@@ -507,7 +519,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
}
private _createRightHandSideEditor(options: IDiffEditorOptions, instantiationService: IInstantiationService): CodeEditorWidget {
const editor = this._createInnerEditor(instantiationService, this._modifiedDomNode, this._adjustOptionsForRightHandSide(options));
const editor = this._createInnerEditor(instantiationService, this._modifiedDomNode, this._adjustOptionsForRightHandSide(options, this._modifiedCodeLens));
this._register(editor.onDidScrollChange((e) => {
if (this._isHandlingScrollEvent) {
@@ -667,9 +679,15 @@ 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.originalEditor.updateOptions(this._adjustOptionsForLeftHandSide(newOptions, this._originalIsEditable));
this.modifiedEditor.updateOptions(this._adjustOptionsForRightHandSide(newOptions, this._modifiedCodeLens));
this.originalEditor.updateOptions(this._adjustOptionsForLeftHandSide(newOptions, this._originalIsEditable, this._originalCodeLens));
// enableSplitViewResizing
if (typeof newOptions.enableSplitViewResizing !== 'undefined') {
@@ -1065,15 +1083,21 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return clonedOptions;
}
private _adjustOptionsForLeftHandSide(options: IDiffEditorOptions, isEditable: boolean): IEditorOptions {
private _adjustOptionsForLeftHandSide(options: IDiffEditorOptions, isEditable: boolean, isCodeLensEnabled: boolean): IEditorOptions {
let result = this._adjustOptionsForSubEditor(options);
if (isCodeLensEnabled) {
result.codeLens = true;
}
result.readOnly = !isEditable;
result.extraEditorClassName = 'original-in-monaco-diff-editor';
return result;
}
private _adjustOptionsForRightHandSide(options: IDiffEditorOptions): IEditorOptions {
private _adjustOptionsForRightHandSide(options: IDiffEditorOptions, isCodeLensEnabled: boolean): IEditorOptions {
let result = this._adjustOptionsForSubEditor(options);
if (isCodeLensEnabled) {
result.codeLens = true;
}
result.revealHorizontalRightPadding = EditorOptions.revealHorizontalRightPadding.defaultValue + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
result.scrollbar!.verticalHasArrows = false;
result.extraEditorClassName = 'modified-in-monaco-diff-editor';