Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8 (#14883)

* Merge from vscode bead496a613e475819f89f08e9e882b841bc1fe8

* Bump distro

* Upgrade GCC to 4.9 due to yarn install errors

* Update build image

* Fix bootstrap base url

* Bump distro

* Fix build errors

* Update source map file

* Disable checkbox for blocking migration issues (#15131)

* disable checkbox for blocking issues

* wip

* disable checkbox fixes

* fix strings

* Remove duplicate tsec command

* Default to off for tab color if settings not present

* re-skip failing tests

* Fix mocha error

* Bump sqlite version & fix notebooks search view

* Turn off esbuild warnings

* Update esbuild log level

* Fix overflowactionbar tests

* Fix ts-ignore in dropdown tests

* cleanup/fixes

* Fix hygiene

* Bundle in entire zone.js module

* Remove extra constructor param

* bump distro for web compile break

* bump distro for web compile break v2

* Undo log level change

* New distro

* Fix integration test scripts

* remove the "no yarn.lock changes" workflow

* fix scripts v2

* Update unit test scripts

* Ensure ads-kerberos2 updates in .vscodeignore

* Try fix unit tests

* Upload crash reports

* remove nogpu

* always upload crashes

* Use bash script

* Consolidate data/ext dir names

* Create in tmp directory

Co-authored-by: chlafreniere <hichise@gmail.com>
Co-authored-by: Christopher Suh <chsuh@microsoft.com>
Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Karl Burtram
2021-04-27 14:01:59 -07:00
committed by GitHub
parent 7e1c0076ba
commit 867a963882
1817 changed files with 81812 additions and 50843 deletions

View File

@@ -12,15 +12,14 @@ import { RunOnceScheduler } from 'vs/base/common/async';
import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import * as objects from 'vs/base/common/objects';
import { URI } from 'vs/base/common/uri';
import { Configuration } from 'vs/editor/browser/config/configuration';
import { StableEditorScrollState } from 'vs/editor/browser/core/editorState';
import * as editorBrowser from 'vs/editor/browser/editorBrowser';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
import { CodeEditorWidget, ICodeEditorWidgetOptions } from 'vs/editor/browser/widget/codeEditorWidget';
import { DiffReview } from 'vs/editor/browser/widget/diffReview';
import { IDiffEditorOptions, IEditorOptions, EditorLayoutInfo, EditorOption, EditorOptions, EditorFontLigatures, stringSet as validateStringSetOption, boolean as validateBooleanOption, InDiffEditorState } from 'vs/editor/common/config/editorOptions';
import { IDiffEditorOptions, EditorLayoutInfo, EditorOption, EditorOptions, EditorFontLigatures, stringSet as validateStringSetOption, boolean as validateBooleanOption } from 'vs/editor/common/config/editorOptions';
import { IPosition, Position } from 'vs/editor/common/core/position';
import { IRange, Range } from 'vs/editor/common/core/range';
import { ISelection, Selection } from 'vs/editor/common/core/selection';
@@ -55,6 +54,11 @@ import { IViewLineTokens } from 'vs/editor/common/core/lineTokens';
import { FontInfo } from 'vs/editor/common/config/fontInfo';
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
export interface IDiffCodeEditorWidgetOptions {
originalEditor?: ICodeEditorWidgetOptions;
modifiedEditor?: ICodeEditorWidgetOptions;
}
interface IEditorDiffDecorations {
decorations: IModelDeltaDecoration[];
overviewZones: OverviewRulerZone[];
@@ -110,7 +114,7 @@ class VisualEditorState {
this._decorations = editor.deltaDecorations(this._decorations, []);
}
public apply(editor: CodeEditorWidget, overviewRuler: editorBrowser.IOverviewRuler, newDecorations: IEditorDiffDecorationsWithZones, restoreScrollState: boolean): void {
public apply(editor: CodeEditorWidget, overviewRuler: editorBrowser.IOverviewRuler | null, newDecorations: IEditorDiffDecorationsWithZones, restoreScrollState: boolean): void {
const scrollState = restoreScrollState ? StableEditorScrollState.capture(editor) : null;
@@ -156,8 +160,8 @@ class VisualEditorState {
let DIFF_EDITOR_ID = 0;
const diffInsertIcon = registerIcon('diff-insert', Codicon.add, nls.localize('diffInsertIcon', 'Line decoration for inserts in the diff editor'));
const diffRemoveIcon = registerIcon('diff-remove', Codicon.remove, nls.localize('diffRemoveIcon', 'Line decoration for removals in the diff editor'));
const diffInsertIcon = registerIcon('diff-insert', Codicon.add, nls.localize('diffInsertIcon', 'Line decoration for inserts in the diff editor.'));
const diffRemoveIcon = registerIcon('diff-remove', Codicon.remove, nls.localize('diffRemoveIcon', 'Line decoration for removals in the diff editor.'));
const ttPolicy = window.trustedTypes?.createPolicy('diffEditorWidget', { createHTML: value => value });
export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffEditor {
@@ -213,8 +217,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
private _maxComputationTime: number;
private _renderIndicators: boolean;
private _enableSplitViewResizing: boolean;
private _wordWrap: 'off' | 'on' | 'wordWrapColumn' | 'bounded' | undefined;
private _wordWrapMinified: boolean | undefined;
private _renderOverviewRuler: boolean;
private _strategy!: DiffEditorWidgetStyle;
private readonly _updateDecorationsRunner: RunOnceScheduler;
@@ -230,7 +233,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
constructor(
domElement: HTMLElement,
options: editorBrowser.IDiffEditorConstructionOptions,
options: Readonly<editorBrowser.IDiffEditorConstructionOptions>,
codeEditorWidgetOptions: IDiffCodeEditorWidgetOptions,
@IClipboardService clipboardService: IClipboardService,
@IEditorWorkerService editorWorkerService: IEditorWorkerService,
@IContextKeyService contextKeyService: IContextKeyService,
@@ -259,9 +263,6 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._domElement = domElement;
options = options || {};
this._wordWrap = options.wordWrap;
this._wordWrapMinified = options.wordWrapMinified;
// renderSideBySide
this._renderSideBySide = true;
if (typeof options.renderSideBySide !== 'undefined') {
@@ -296,6 +297,11 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._contextKeyService.createKey('isInEmbeddedDiffEditor', false);
}
this._renderOverviewRuler = true;
if (typeof options.renderOverviewRuler !== 'undefined') {
this._renderOverviewRuler = Boolean(options.renderOverviewRuler);
}
this._updateDecorationsRunner = this._register(new RunOnceScheduler(() => this._updateDecorations(), 0));
this._containerDomElement = document.createElement('div');
@@ -317,7 +323,9 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._register(dom.addStandardDisposableListener(this._overviewDomElement, 'mousedown', (e) => {
this._modifiedEditor.delegateVerticalScrollbarMouseDown(e);
}));
this._containerDomElement.appendChild(this._overviewDomElement);
if (this._renderOverviewRuler) {
this._containerDomElement.appendChild(this._overviewDomElement);
}
// Create left side
this._originalDomNode = document.createElement('div');
@@ -343,7 +351,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._isVisible = true;
this._isHandlingScrollEvent = false;
this._elementSizeObserver = this._register(new ElementSizeObserver(this._containerDomElement, undefined, () => this._onDidContainerSizeChanged()));
this._elementSizeObserver = this._register(new ElementSizeObserver(this._containerDomElement, options.dimension, () => this._onDidContainerSizeChanged()));
if (options.automaticLayout) {
this._elementSizeObserver.startObserving();
}
@@ -362,8 +370,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
rightServices.set(IContextKeyService, rightContextKeyService);
const rightScopedInstantiationService = instantiationService.createChild(rightServices);
this._originalEditor = this._createLeftHandSideEditor(options, leftScopedInstantiationService, leftContextKeyService);
this._modifiedEditor = this._createRightHandSideEditor(options, rightScopedInstantiationService, rightContextKeyService);
this._originalEditor = this._createLeftHandSideEditor(options, codeEditorWidgetOptions.originalEditor || {}, leftScopedInstantiationService, leftContextKeyService);
this._modifiedEditor = this._createRightHandSideEditor(options, codeEditorWidgetOptions.modifiedEditor || {}, rightScopedInstantiationService, rightContextKeyService);
this._originalOverviewRuler = null;
this._modifiedOverviewRuler = null;
@@ -424,6 +432,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return this._modifiedEditor.getContentHeight();
}
public getViewWidth(): number {
return this._elementSizeObserver.getWidth();
}
private _setState(newState: editorBrowser.DiffEditorState): void {
if (this._state === newState) {
return;
@@ -462,6 +474,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
}
private _recreateOverviewRulers(): void {
if (!this._renderOverviewRuler) {
return;
}
if (this._originalOverviewRuler) {
this._overviewDomElement.removeChild(this._originalOverviewRuler.getDomNode());
this._originalOverviewRuler.dispose();
@@ -483,8 +499,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._layoutOverviewRulers();
}
private _createLeftHandSideEditor(options: editorBrowser.IDiffEditorConstructionOptions, instantiationService: IInstantiationService, contextKeyService: IContextKeyService): CodeEditorWidget {
const editor = this._createInnerEditor(instantiationService, this._originalDomNode, this._adjustOptionsForLeftHandSide(options));
private _createLeftHandSideEditor(options: Readonly<editorBrowser.IDiffEditorConstructionOptions>, codeEditorWidgetOptions: ICodeEditorWidgetOptions, instantiationService: IInstantiationService, contextKeyService: IContextKeyService): CodeEditorWidget {
const editor = this._createInnerEditor(instantiationService, this._originalDomNode, this._adjustOptionsForLeftHandSide(options), codeEditorWidgetOptions);
this._register(editor.onDidScrollChange((e) => {
if (this._isHandlingScrollEvent) {
@@ -545,8 +561,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return editor;
}
private _createRightHandSideEditor(options: editorBrowser.IDiffEditorConstructionOptions, instantiationService: IInstantiationService, contextKeyService: IContextKeyService): CodeEditorWidget {
const editor = this._createInnerEditor(instantiationService, this._modifiedDomNode, this._adjustOptionsForRightHandSide(options));
private _createRightHandSideEditor(options: Readonly<editorBrowser.IDiffEditorConstructionOptions>, codeEditorWidgetOptions: ICodeEditorWidgetOptions, instantiationService: IInstantiationService, contextKeyService: IContextKeyService): CodeEditorWidget {
const editor = this._createInnerEditor(instantiationService, this._modifiedDomNode, this._adjustOptionsForRightHandSide(options), codeEditorWidgetOptions);
this._register(editor.onDidScrollChange((e) => {
if (this._isHandlingScrollEvent) {
@@ -613,8 +629,8 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return editor;
}
protected _createInnerEditor(instantiationService: IInstantiationService, container: HTMLElement, options: IEditorOptions): CodeEditorWidget {
return instantiationService.createInstance(CodeEditorWidget, container, options, {});
protected _createInnerEditor(instantiationService: IInstantiationService, container: HTMLElement, options: Readonly<editorBrowser.IEditorConstructionOptions>, editorWidgetOptions: ICodeEditorWidgetOptions): CodeEditorWidget {
return instantiationService.createInstance(CodeEditorWidget, container, options, editorWidgetOptions);
}
public dispose(): void {
@@ -636,7 +652,9 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._modifiedOverviewRuler.dispose();
}
this._overviewDomElement.removeChild(this._overviewViewportDomElement.domNode);
this._containerDomElement.removeChild(this._overviewDomElement);
if (this._renderOverviewRuler) {
this._containerDomElement.removeChild(this._overviewDomElement);
}
this._containerDomElement.removeChild(this._originalDomNode);
this._originalEditor.dispose();
@@ -687,10 +705,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return this._modifiedEditor;
}
public updateOptions(newOptions: IDiffEditorOptions): void {
this._wordWrap = typeof newOptions.wordWrap !== 'undefined' ? newOptions.wordWrap : this._wordWrap;
this._wordWrapMinified = typeof newOptions.wordWrapMinified !== 'undefined' ? newOptions.wordWrapMinified : this._wordWrapMinified;
public updateOptions(newOptions: Readonly<IDiffEditorOptions>): void {
// Handle side by side
let renderSideBySideChanged = false;
@@ -752,6 +767,16 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
// Update class name
this._containerDomElement.className = DiffEditorWidget._getClassName(this._themeService.getColorTheme(), this._renderSideBySide);
}
// renderOverviewRuler
if (typeof newOptions.renderOverviewRuler !== 'undefined' && this._renderOverviewRuler !== newOptions.renderOverviewRuler) {
this._renderOverviewRuler = newOptions.renderOverviewRuler;
if (this._renderOverviewRuler) {
this._containerDomElement.appendChild(this._overviewDomElement);
} else {
this._containerDomElement.removeChild(this._overviewDomElement);
}
}
}
public getModel(): editorCommon.IDiffEditorModel {
@@ -761,7 +786,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
};
}
public setModel(model: editorCommon.IDiffEditorModel): void {
public setModel(model: editorCommon.IDiffEditorModel | null): void {
// Guard us against partial null model
if (model && (!model.original || !model.modified)) {
throw new Error(!model.original ? 'DiffEditorWidget.setModel: Original model is null' : 'DiffEditorWidget.setModel: Modified model is null');
@@ -923,7 +948,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
}
public restoreViewState(s: editorCommon.IDiffEditorViewState): void {
if (s.original && s.modified) {
if (s && s.original && s.modified) {
const diffEditorState = <editorCommon.IDiffEditorViewState>s;
this._originalEditor.restoreViewState(diffEditorState.original);
this._modifiedEditor.restoreViewState(diffEditorState.modified);
@@ -981,6 +1006,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
}
private _layoutOverviewRulers(): void {
if (!this._renderOverviewRuler) {
return;
}
if (!this._originalOverviewRuler || !this._modifiedOverviewRuler) {
return;
}
@@ -1091,9 +1120,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
}
private _updateDecorations(): void {
if (!this._originalEditor.getModel() || !this._modifiedEditor.getModel() || !this._originalOverviewRuler || !this._modifiedOverviewRuler) {
if (!this._originalEditor.getModel() || !this._modifiedEditor.getModel()) {
return;
}
const lineChanges = (this._diffComputationResult ? this._diffComputationResult.changes : []);
const foreignOriginal = this._originalEditorState.getForeignViewZones(this._originalEditor.getWhitespaces());
@@ -1111,15 +1141,15 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
}
}
private _adjustOptionsForSubEditor(options: editorBrowser.IDiffEditorConstructionOptions): editorBrowser.IDiffEditorConstructionOptions {
const clonedOptions: editorBrowser.IDiffEditorConstructionOptions = objects.deepClone(options || {});
private _adjustOptionsForSubEditor(options: Readonly<editorBrowser.IDiffEditorConstructionOptions>): editorBrowser.IEditorConstructionOptions {
const clonedOptions = { ...options };
clonedOptions.inDiffEditor = true;
clonedOptions.automaticLayout = false;
clonedOptions.scrollbar = clonedOptions.scrollbar || {};
clonedOptions.scrollbar.vertical = 'visible';
clonedOptions.folding = false;
clonedOptions.codeLens = this._diffCodeLens;
clonedOptions.fixedOverflowWidgets = true;
clonedOptions.overflowWidgetsDomNode = options.overflowWidgetsDomNode;
// clonedOptions.lineDecorationsWidth = '2ch';
if (!clonedOptions.minimap) {
clonedOptions.minimap = {};
@@ -1128,37 +1158,38 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return clonedOptions;
}
private _adjustOptionsForLeftHandSide(options: editorBrowser.IDiffEditorConstructionOptions): editorBrowser.IEditorConstructionOptions {
private _adjustOptionsForLeftHandSide(options: Readonly<editorBrowser.IDiffEditorConstructionOptions>): editorBrowser.IEditorConstructionOptions {
const result = this._adjustOptionsForSubEditor(options);
result.inDiffEditor = (this._renderSideBySide ? InDiffEditorState.SideBySideLeft : InDiffEditorState.InlineLeft);
if (!this._renderSideBySide) {
// do not wrap hidden editor
result.wordWrap = 'off';
result.wordWrapMinified = false;
} else if (this._diffWordWrap === 'inherit') {
result.wordWrap = this._wordWrap;
result.wordWrapMinified = this._wordWrapMinified;
// never wrap hidden editor
result.wordWrapOverride1 = 'off';
} else {
result.wordWrap = this._diffWordWrap;
result.wordWrapMinified = this._wordWrapMinified;
result.wordWrapOverride1 = this._diffWordWrap;
}
result.readOnly = !this._originalIsEditable;
result.extraEditorClassName = 'original-in-monaco-diff-editor';
return result;
return {
...result,
dimension: {
height: 0,
width: 0
}
};
}
private _adjustOptionsForRightHandSide(options: editorBrowser.IDiffEditorConstructionOptions): editorBrowser.IEditorConstructionOptions {
private _adjustOptionsForRightHandSide(options: Readonly<editorBrowser.IDiffEditorConstructionOptions>): editorBrowser.IEditorConstructionOptions {
const result = this._adjustOptionsForSubEditor(options);
result.inDiffEditor = (this._renderSideBySide ? InDiffEditorState.SideBySideRight : InDiffEditorState.InlineRight);
if (this._diffWordWrap === 'inherit') {
result.wordWrap = this._wordWrap;
} else {
result.wordWrap = this._diffWordWrap;
}
result.wordWrapOverride1 = this._diffWordWrap;
result.revealHorizontalRightPadding = EditorOptions.revealHorizontalRightPadding.defaultValue + DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
result.scrollbar!.verticalHasArrows = false;
result.extraEditorClassName = 'modified-in-monaco-diff-editor';
return result;
return {
...result,
dimension: {
height: 0,
width: 0
}
};
}
public doLayout(): void {
@@ -1187,7 +1218,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._overviewViewportDomElement.setHeight(30);
this._originalEditor.layout({ width: splitPoint, height: (height - reviewHeight) });
this._modifiedEditor.layout({ width: width - splitPoint - DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH, height: (height - reviewHeight) });
this._modifiedEditor.layout({ width: width - splitPoint - (this._renderOverviewRuler ? DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH : 0), height: (height - reviewHeight) });
if (this._originalOverviewRuler || this._modifiedOverviewRuler) {
this._layoutOverviewRulers();
@@ -1241,6 +1272,12 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
return (this._elementSizeObserver.getHeight() - this._getReviewHeight());
},
getOptions: () => {
return {
renderOverviewRuler: this._renderOverviewRuler
};
},
getContainerDomNode: () => {
return this._containerDomElement;
},
@@ -1370,6 +1407,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
interface IDataSource {
getWidth(): number;
getHeight(): number;
getOptions(): { renderOverviewRuler: boolean; };
getContainerDomNode(): HTMLElement;
relayoutEditors(): void;
@@ -1841,7 +1879,7 @@ class DiffEditorWidgetSideBySide extends DiffEditorWidgetStyle implements IVerti
public layout(sashRatio: number | null = this._sashRatio): number {
const w = this._dataSource.getWidth();
const contentWidth = w - DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
const contentWidth = w - (this._dataSource.getOptions().renderOverviewRuler ? DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH : 0);
let sashPosition = Math.floor((sashRatio || 0.5) * contentWidth);
const midPoint = Math.floor(0.5 * contentWidth);
@@ -1874,7 +1912,7 @@ class DiffEditorWidgetSideBySide extends DiffEditorWidgetStyle implements IVerti
private _onSashDrag(e: ISashEvent): void {
const w = this._dataSource.getWidth();
const contentWidth = w - DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH;
const contentWidth = w - (this._dataSource.getOptions().renderOverviewRuler ? DiffEditorWidget.ENTIRE_DIFF_OVERVIEW_WIDTH : 0);
const sashPosition = this.layout((this._startSashPosition! + (e.currentX - e.startX)) / contentWidth);
this._sashRatio = sashPosition / contentWidth;
@@ -2405,7 +2443,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
const html = sb.build();
const trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;
domNode.innerHTML = trustedhtml as unknown as string;
domNode.innerHTML = trustedhtml as string;
viewZone.minWidthInPx = (maxCharsPerLine * typicalHalfwidthCharacterWidth);
if (viewLineCounts) {