mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -11,7 +11,6 @@ import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
|
||||
import { ISashEvent, IVerticalSashLayoutProvider, Sash } from 'vs/base/browser/ui/sash/sash';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -24,7 +23,7 @@ import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
|
||||
import { renderViewLine, RenderLineInput } from 'vs/editor/common/viewLayout/viewLineRenderer';
|
||||
import * as editorBrowser from 'vs/editor/browser/editorBrowser';
|
||||
import { CodeEditor } from 'vs/editor/browser/codeEditor';
|
||||
import { ViewLineToken } from 'vs/editor/common/core/viewLineToken';
|
||||
import { LineTokens } from 'vs/editor/common/core/lineTokens';
|
||||
import { Configuration } from 'vs/editor/browser/config/configuration';
|
||||
import { Position, IPosition } from 'vs/editor/common/core/position';
|
||||
import { Selection, ISelection } from 'vs/editor/common/core/selection';
|
||||
@@ -38,14 +37,15 @@ import { scrollbarShadow, diffInserted, diffRemoved, defaultInsertColor, default
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { OverviewRulerZone } from 'vs/editor/common/view/overviewZoneManager';
|
||||
import { IEditorWhitespace } from 'vs/editor/common/viewLayout/whitespaceComputer';
|
||||
import { ModelDecorationOptions } from 'vs/editor/common/model/textModelWithDecorations';
|
||||
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
|
||||
import { DiffReview } from 'vs/editor/browser/widget/diffReview';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { IMessageService } from 'vs/platform/message/common/message';
|
||||
import { IStringBuilder, createStringBuilder } from 'vs/editor/common/core/stringBuilder';
|
||||
import { IModelDeltaDecoration, IModelDecorationsChangeAccessor, ITextModel } from 'vs/editor/common/model';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
interface IEditorDiffDecorations {
|
||||
decorations: editorCommon.IModelDeltaDecoration[];
|
||||
decorations: IModelDeltaDecoration[];
|
||||
overviewZones: OverviewRulerZone[];
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class VisualEditorState {
|
||||
|
||||
// (2) Model decorations
|
||||
if (this._decorations.length > 0) {
|
||||
editor.changeDecorations((changeAccessor: editorCommon.IModelDecorationsChangeAccessor) => {
|
||||
editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {
|
||||
changeAccessor.deltaDecorations(this._decorations, []);
|
||||
});
|
||||
}
|
||||
@@ -191,7 +191,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
protected _contextKeyService: IContextKeyService;
|
||||
private _codeEditorService: ICodeEditorService;
|
||||
private _themeService: IThemeService;
|
||||
private readonly _messageService: IMessageService;
|
||||
private _notificationService: INotificationService;
|
||||
|
||||
private _reviewPane: DiffReview;
|
||||
|
||||
@@ -203,16 +203,16 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@ICodeEditorService codeEditorService: ICodeEditorService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IMessageService messageService: IMessageService
|
||||
@INotificationService notificationService: INotificationService
|
||||
) {
|
||||
super();
|
||||
|
||||
this._editorWorkerService = editorWorkerService;
|
||||
this._codeEditorService = codeEditorService;
|
||||
this._contextKeyService = contextKeyService.createScoped(domElement);
|
||||
this._contextKeyService = this._register(contextKeyService.createScoped(domElement));
|
||||
this._contextKeyService.createKey('isInDiffEditor', true);
|
||||
this._themeService = themeService;
|
||||
this._messageService = messageService;
|
||||
this._notificationService = notificationService;
|
||||
|
||||
this.id = (++DIFF_EDITOR_ID);
|
||||
|
||||
@@ -313,14 +313,14 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
this._setStrategy(new DiffEdtorWidgetInline(this._createDataSource(), this._enableSplitViewResizing));
|
||||
}
|
||||
|
||||
this._codeEditorService.addDiffEditor(this);
|
||||
|
||||
this._register(themeService.onThemeChange(t => {
|
||||
if (this._strategy && this._strategy.applyColors(t)) {
|
||||
this._updateDecorationsRunner.schedule();
|
||||
}
|
||||
this._containerDomElement.className = DiffEditorWidget._getClassName(this._themeService.getTheme(), this._renderSideBySide);
|
||||
}));
|
||||
|
||||
this._codeEditorService.addDiffEditor(this);
|
||||
}
|
||||
|
||||
public get ignoreTrimWhitespace(): boolean {
|
||||
@@ -361,14 +361,14 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
this._overviewDomElement.removeChild(this._originalOverviewRuler.getDomNode());
|
||||
this._originalOverviewRuler.dispose();
|
||||
}
|
||||
this._originalOverviewRuler = this.originalEditor.createOverviewRuler('original diffOverviewRuler', 4, Number.MAX_VALUE);
|
||||
this._originalOverviewRuler = this.originalEditor.createOverviewRuler('original diffOverviewRuler');
|
||||
this._overviewDomElement.appendChild(this._originalOverviewRuler.getDomNode());
|
||||
|
||||
if (this._modifiedOverviewRuler) {
|
||||
this._overviewDomElement.removeChild(this._modifiedOverviewRuler.getDomNode());
|
||||
this._modifiedOverviewRuler.dispose();
|
||||
}
|
||||
this._modifiedOverviewRuler = this.modifiedEditor.createOverviewRuler('modified diffOverviewRuler', 4, Number.MAX_VALUE);
|
||||
this._modifiedOverviewRuler = this.modifiedEditor.createOverviewRuler('modified diffOverviewRuler');
|
||||
this._overviewDomElement.appendChild(this._modifiedOverviewRuler.getDomNode());
|
||||
|
||||
this._layoutOverviewRulers();
|
||||
@@ -465,20 +465,37 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
public dispose(): void {
|
||||
this._codeEditorService.removeDiffEditor(this);
|
||||
|
||||
if (this._beginUpdateDecorationsTimeout !== -1) {
|
||||
window.clearTimeout(this._beginUpdateDecorationsTimeout);
|
||||
this._beginUpdateDecorationsTimeout = -1;
|
||||
}
|
||||
|
||||
window.clearInterval(this._measureDomElementToken);
|
||||
|
||||
this._cleanViewZonesAndDecorations();
|
||||
|
||||
this._overviewDomElement.removeChild(this._originalOverviewRuler.getDomNode());
|
||||
this._originalOverviewRuler.dispose();
|
||||
this._overviewDomElement.removeChild(this._modifiedOverviewRuler.getDomNode());
|
||||
this._modifiedOverviewRuler.dispose();
|
||||
this._overviewDomElement.removeChild(this._overviewViewportDomElement.domNode);
|
||||
this._containerDomElement.removeChild(this._overviewDomElement);
|
||||
|
||||
this._containerDomElement.removeChild(this._originalDomNode);
|
||||
this.originalEditor.dispose();
|
||||
|
||||
this._containerDomElement.removeChild(this._modifiedDomNode);
|
||||
this.modifiedEditor.dispose();
|
||||
|
||||
this._strategy.dispose();
|
||||
|
||||
this._containerDomElement.removeChild(this._reviewPane.domNode.domNode);
|
||||
this._containerDomElement.removeChild(this._reviewPane.shadow.domNode);
|
||||
this._containerDomElement.removeChild(this._reviewPane.actionBarContainer.domNode);
|
||||
this._reviewPane.dispose();
|
||||
|
||||
this._domElement.removeChild(this._containerDomElement);
|
||||
|
||||
this._onDidDispose.fire();
|
||||
|
||||
super.dispose();
|
||||
@@ -746,7 +763,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
this.modifiedEditor.trigger(source, handlerId, payload);
|
||||
}
|
||||
|
||||
public changeDecorations(callback: (changeAccessor: editorCommon.IModelDecorationsChangeAccessor) => any): any {
|
||||
public changeDecorations(callback: (changeAccessor: IModelDecorationsChangeAccessor) => any): any {
|
||||
return this.modifiedEditor.changeDecorations(callback);
|
||||
}
|
||||
|
||||
@@ -852,7 +869,7 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
|
||||
) {
|
||||
this._lastOriginalWarning = currentOriginalModel.uri;
|
||||
this._lastModifiedWarning = currentModifiedModel.uri;
|
||||
this._messageService.show(Severity.Warning, nls.localize("diff.tooLarge", "Cannot compare files because one file is too large."));
|
||||
this._notificationService.warn(nls.localize("diff.tooLarge", "Cannot compare files because one file is too large."));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -1594,6 +1611,7 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
}
|
||||
|
||||
_getOriginalEditorDecorations(lineChanges: editorCommon.ILineChange[], ignoreTrimWhitespace: boolean, renderIndicators: boolean, originalEditor: editorBrowser.ICodeEditor, modifiedEditor: editorBrowser.ICodeEditor): IEditorDiffDecorations {
|
||||
const overviewZoneColor = this._removeColor.toString();
|
||||
|
||||
let result: IEditorDiffDecorations = {
|
||||
decorations: [],
|
||||
@@ -1614,16 +1632,10 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
result.decorations.push(createDecoration(lineChange.originalStartLineNumber, 1, lineChange.originalEndLineNumber, Number.MAX_VALUE, DECORATIONS.charDeleteWholeLine));
|
||||
}
|
||||
|
||||
let color = this._removeColor.toString();
|
||||
|
||||
result.overviewZones.push(new OverviewRulerZone(
|
||||
lineChange.originalStartLineNumber,
|
||||
lineChange.originalEndLineNumber,
|
||||
editorCommon.OverviewRulerLane.Full,
|
||||
0,
|
||||
color,
|
||||
color,
|
||||
color
|
||||
overviewZoneColor
|
||||
));
|
||||
|
||||
if (lineChange.charChanges) {
|
||||
@@ -1659,6 +1671,7 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
}
|
||||
|
||||
_getModifiedEditorDecorations(lineChanges: editorCommon.ILineChange[], ignoreTrimWhitespace: boolean, renderIndicators: boolean, originalEditor: editorBrowser.ICodeEditor, modifiedEditor: editorBrowser.ICodeEditor): IEditorDiffDecorations {
|
||||
const overviewZoneColor = this._insertColor.toString();
|
||||
|
||||
let result: IEditorDiffDecorations = {
|
||||
decorations: [],
|
||||
@@ -1679,15 +1692,10 @@ class DiffEdtorWidgetSideBySide extends DiffEditorWidgetStyle implements IDiffEd
|
||||
if (!isChangeOrDelete(lineChange) || !lineChange.charChanges) {
|
||||
result.decorations.push(createDecoration(lineChange.modifiedStartLineNumber, 1, lineChange.modifiedEndLineNumber, Number.MAX_VALUE, DECORATIONS.charInsertWholeLine));
|
||||
}
|
||||
let color = this._insertColor.toString();
|
||||
result.overviewZones.push(new OverviewRulerZone(
|
||||
lineChange.modifiedStartLineNumber,
|
||||
lineChange.modifiedEndLineNumber,
|
||||
editorCommon.OverviewRulerLane.Full,
|
||||
0,
|
||||
color,
|
||||
color,
|
||||
color
|
||||
overviewZoneColor
|
||||
));
|
||||
|
||||
if (lineChange.charChanges) {
|
||||
@@ -1783,6 +1791,8 @@ class DiffEdtorWidgetInline extends DiffEditorWidgetStyle implements IDiffEditor
|
||||
}
|
||||
|
||||
_getOriginalEditorDecorations(lineChanges: editorCommon.ILineChange[], ignoreTrimWhitespace: boolean, renderIndicators: boolean, originalEditor: editorBrowser.ICodeEditor, modifiedEditor: editorBrowser.ICodeEditor): IEditorDiffDecorations {
|
||||
const overviewZoneColor = this._removeColor.toString();
|
||||
|
||||
let result: IEditorDiffDecorations = {
|
||||
decorations: [],
|
||||
overviewZones: []
|
||||
@@ -1798,15 +1808,10 @@ class DiffEdtorWidgetInline extends DiffEditorWidgetStyle implements IDiffEditor
|
||||
options: DECORATIONS.lineDeleteMargin
|
||||
});
|
||||
|
||||
let color = this._removeColor.toString();
|
||||
result.overviewZones.push(new OverviewRulerZone(
|
||||
lineChange.originalStartLineNumber,
|
||||
lineChange.originalEndLineNumber,
|
||||
editorCommon.OverviewRulerLane.Full,
|
||||
0,
|
||||
color,
|
||||
color,
|
||||
color
|
||||
overviewZoneColor
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -1815,6 +1820,7 @@ class DiffEdtorWidgetInline extends DiffEditorWidgetStyle implements IDiffEditor
|
||||
}
|
||||
|
||||
_getModifiedEditorDecorations(lineChanges: editorCommon.ILineChange[], ignoreTrimWhitespace: boolean, renderIndicators: boolean, originalEditor: editorBrowser.ICodeEditor, modifiedEditor: editorBrowser.ICodeEditor): IEditorDiffDecorations {
|
||||
const overviewZoneColor = this._insertColor.toString();
|
||||
|
||||
let result: IEditorDiffDecorations = {
|
||||
decorations: [],
|
||||
@@ -1833,15 +1839,10 @@ class DiffEdtorWidgetInline extends DiffEditorWidgetStyle implements IDiffEditor
|
||||
options: (renderIndicators ? DECORATIONS.lineInsertWithSign : DECORATIONS.lineInsert)
|
||||
});
|
||||
|
||||
let color = this._insertColor.toString();
|
||||
result.overviewZones.push(new OverviewRulerZone(
|
||||
lineChange.modifiedStartLineNumber,
|
||||
lineChange.modifiedEndLineNumber,
|
||||
editorCommon.OverviewRulerLane.Full,
|
||||
0,
|
||||
color,
|
||||
color,
|
||||
color
|
||||
overviewZoneColor
|
||||
));
|
||||
|
||||
if (lineChange.charChanges) {
|
||||
@@ -1887,7 +1888,7 @@ class DiffEdtorWidgetInline extends DiffEditorWidgetStyle implements IDiffEditor
|
||||
|
||||
class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
|
||||
private originalModel: editorCommon.IModel;
|
||||
private originalModel: ITextModel;
|
||||
private modifiedEditorConfiguration: editorOptions.InternalEditorOptions;
|
||||
private modifiedEditorTabSize: number;
|
||||
private renderIndicators: boolean;
|
||||
@@ -1962,7 +1963,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
};
|
||||
}
|
||||
|
||||
private renderOriginalLine(count: number, originalModel: editorCommon.IModel, config: editorOptions.InternalEditorOptions, tabSize: number, lineNumber: number, decorations: InlineDecoration[], sb: IStringBuilder): void {
|
||||
private renderOriginalLine(count: number, originalModel: ITextModel, config: editorOptions.InternalEditorOptions, tabSize: number, lineNumber: number, decorations: InlineDecoration[], sb: IStringBuilder): void {
|
||||
let lineContent = originalModel.getLineContent(lineNumber);
|
||||
|
||||
let actualDecorations = LineDecoration.filter(decorations, lineNumber, 1, lineContent.length + 1);
|
||||
@@ -1973,6 +1974,12 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
| (ColorId.DefaultBackground << MetadataConsts.BACKGROUND_OFFSET)
|
||||
) >>> 0;
|
||||
|
||||
const tokens = new Uint32Array(2);
|
||||
tokens[0] = lineContent.length;
|
||||
tokens[1] = defaultMetadata;
|
||||
|
||||
const lineTokens = new LineTokens(tokens, lineContent);
|
||||
|
||||
sb.appendASCIIString('<div class="view-line');
|
||||
if (decorations.length === 0) {
|
||||
// No char changes
|
||||
@@ -1987,7 +1994,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
|
||||
lineContent,
|
||||
originalModel.mightContainRTL(),
|
||||
0,
|
||||
[new ViewLineToken(lineContent.length, defaultMetadata)],
|
||||
lineTokens,
|
||||
actualDecorations,
|
||||
tabSize,
|
||||
config.fontInfo.spaceWidth,
|
||||
|
||||
Reference in New Issue
Block a user