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

@@ -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.")
}
}
};

View File

@@ -11,7 +11,6 @@ import { Constants } from 'vs/base/common/uint';
import { USUAL_WORD_SEPARATORS } from 'vs/editor/common/model/wordHelper';
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
import { IConfigurationPropertySchema } from 'vs/platform/configuration/common/configurationRegistry';
import { IDimension } from 'vs/editor/common/editorCommon';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
//#region typed options
@@ -600,13 +599,6 @@ export interface IEditorOptions {
showDeprecated?: boolean;
}
export interface IEditorConstructionOptions extends IEditorOptions {
/**
* The initial editor dimension (to avoid measuring the container).
*/
dimension?: IDimension;
}
/**
* @internal
* The width of the minimap gutter, in pixels.
@@ -647,12 +639,20 @@ export interface IDiffEditorOptions extends IEditorOptions {
* Defaults to false.
*/
originalEditable?: boolean;
// {{SQL CARBON EDIT}}
/**
/** // {{SQL CARBON EDIT}}
* Adding option to reverse coloring in diff editor
*/
reverse?: boolean;
/**
* Original editor should be have code lens enabled?
* Defaults to false.
*/
originalCodeLens?: boolean;
/**
* Modified editor should be have code lens enabled?
* Defaults to false.
*/
modifiedCodeLens?: boolean;
}
//#endregion
@@ -1076,6 +1076,11 @@ export interface IEditorCommentsOptions {
* Defaults to true.
*/
insertSpace?: boolean;
/**
* Ignore empty lines when inserting line comments.
* Defaults to true.
*/
ignoreEmptyLines?: boolean;
}
export type EditorCommentsOptions = Readonly<Required<IEditorCommentsOptions>>;
@@ -1085,6 +1090,7 @@ class EditorComments extends BaseEditorOption<EditorOption.comments, EditorComme
constructor() {
const defaults: EditorCommentsOptions = {
insertSpace: true,
ignoreEmptyLines: true,
};
super(
EditorOption.comments, 'comments', defaults,
@@ -1094,6 +1100,11 @@ class EditorComments extends BaseEditorOption<EditorOption.comments, EditorComme
default: defaults.insertSpace,
description: nls.localize('comments.insertSpace', "Controls whether a space character is inserted when commenting.")
},
'editor.comments.ignoreEmptyLines': {
type: 'boolean',
default: defaults.ignoreEmptyLines,
description: nls.localize('comments.ignoreEmptyLines', 'Controls if empty lines should be ignored with toggle, add or remove actions for line comments.')
},
}
);
}
@@ -1105,6 +1116,7 @@ class EditorComments extends BaseEditorOption<EditorOption.comments, EditorComme
const input = _input as IEditorCommentsOptions;
return {
insertSpace: EditorBooleanOption.boolean(input.insertSpace, this.defaultValue.insertSpace),
ignoreEmptyLines: EditorBooleanOption.boolean(input.ignoreEmptyLines, this.defaultValue.ignoreEmptyLines),
};
}
}

View File

@@ -31,6 +31,7 @@ export class MirrorTextModel {
protected _eol: string;
protected _versionId: number;
protected _lineStarts: PrefixSumComputer | null;
private _cachedTextValue: string | null;
constructor(uri: URI, lines: string[], eol: string, versionId: number) {
this._uri = uri;
@@ -38,6 +39,7 @@ export class MirrorTextModel {
this._eol = eol;
this._versionId = versionId;
this._lineStarts = null;
this._cachedTextValue = null;
}
dispose(): void {
@@ -49,7 +51,10 @@ export class MirrorTextModel {
}
getText(): string {
return this._lines.join(this._eol);
if (this._cachedTextValue === null) {
this._cachedTextValue = this._lines.join(this._eol);
}
return this._cachedTextValue;
}
onEvents(e: IModelChangedEvent): void {
@@ -66,6 +71,7 @@ export class MirrorTextModel {
}
this._versionId = e.versionId;
this._cachedTextValue = null;
}
protected _ensureLineStarts(): void {

View File

@@ -239,7 +239,7 @@ class PieceTreeSearchCache {
this._cache.push(nodePosition);
}
public valdiate(offset: number) {
public validate(offset: number) {
let hasInvalidVal = false;
let tmp: Array<CacheEntry | null> = this._cache;
for (let i = 0; i < tmp.length; i++) {
@@ -838,7 +838,7 @@ export class PieceTreeBase {
if (nodeStartOffset === offset) {
this.insertContentToNodeLeft(value, node);
this._searchCache.valdiate(offset);
this._searchCache.validate(offset);
} else if (nodeStartOffset + node.piece.length > offset) {
// we are inserting into the middle of a node.
let nodesToDel: TreeNode[] = [];
@@ -938,7 +938,7 @@ export class PieceTreeBase {
return;
}
this.deleteNodeHead(startNode, endSplitPosInBuffer);
this._searchCache.valdiate(offset);
this._searchCache.validate(offset);
this.validateCRLFWithPrevNode(startNode);
this.computeBufferMetadata();
return;
@@ -961,7 +961,7 @@ export class PieceTreeBase {
let startSplitPosInBuffer = this.positionInBuffer(startNode, startPosition.remainder);
this.deleteNodeTail(startNode, startSplitPosInBuffer);
this._searchCache.valdiate(offset);
this._searchCache.validate(offset);
if (startNode.piece.length === 0) {
nodesToDel.push(startNode);
}
@@ -1225,14 +1225,14 @@ export class PieceTreeBase {
let cache = this._searchCache.get2(lineNumber);
if (cache) {
x = cache.node;
let prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber - 1);
let prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber - 1);
let buffer = this._buffers[x.piece.bufferIndex].buffer;
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
if (cache.nodeStartLineNumber + x.piece.lineFeedCnt === lineNumber) {
ret = buffer.substring(startOffset + prevAccumualtedValue, startOffset + x.piece.length);
ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);
} else {
let accumualtedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber);
return buffer.substring(startOffset + prevAccumualtedValue, startOffset + accumualtedValue - endOffset);
let accumulatedValue = this.getAccumulatedValue(x, lineNumber - cache.nodeStartLineNumber);
return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);
}
} else {
let nodeStartOffset = 0;
@@ -1241,8 +1241,8 @@ export class PieceTreeBase {
if (x.left !== SENTINEL && x.lf_left >= lineNumber - 1) {
x = x.left;
} else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {
let prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
let accumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
let prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
let accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
let buffer = this._buffers[x.piece.bufferIndex].buffer;
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
nodeStartOffset += x.size_left;
@@ -1252,13 +1252,13 @@ export class PieceTreeBase {
nodeStartLineNumber: originalLineNumber - (lineNumber - 1 - x.lf_left)
});
return buffer.substring(startOffset + prevAccumualtedValue, startOffset + accumualtedValue - endOffset);
return buffer.substring(startOffset + prevAccumulatedValue, startOffset + accumulatedValue - endOffset);
} else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {
let prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
let prevAccumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
let buffer = this._buffers[x.piece.bufferIndex].buffer;
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret = buffer.substring(startOffset + prevAccumualtedValue, startOffset + x.piece.length);
ret = buffer.substring(startOffset + prevAccumulatedValue, startOffset + x.piece.length);
break;
} else {
lineNumber -= x.lf_left + x.piece.lineFeedCnt;
@@ -1274,10 +1274,10 @@ export class PieceTreeBase {
let buffer = this._buffers[x.piece.bufferIndex].buffer;
if (x.piece.lineFeedCnt > 0) {
let accumualtedValue = this.getAccumulatedValue(x, 0);
let accumulatedValue = this.getAccumulatedValue(x, 0);
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
ret += buffer.substring(startOffset, startOffset + accumualtedValue - endOffset);
ret += buffer.substring(startOffset, startOffset + accumulatedValue - endOffset);
return ret;
} else {
let startOffset = this.offsetInBuffer(x.piece.bufferIndex, x.piece.start);
@@ -1304,7 +1304,7 @@ export class PieceTreeBase {
this._lineCnt = lfCnt;
this._length = len;
this._searchCache.valdiate(this._length);
this._searchCache.validate(this._length);
}
// #region node operations
@@ -1504,12 +1504,12 @@ export class PieceTreeBase {
x = x.left;
} else if (x.lf_left + x.piece.lineFeedCnt > lineNumber - 1) {
let prevAccumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 2);
let accumualtedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
let accumulatedValue = this.getAccumulatedValue(x, lineNumber - x.lf_left - 1);
nodeStartOffset += x.size_left;
return {
node: x,
remainder: Math.min(prevAccumualtedValue + column - 1, accumualtedValue),
remainder: Math.min(prevAccumualtedValue + column - 1, accumulatedValue),
nodeStartOffset
};
} else if (x.lf_left + x.piece.lineFeedCnt === lineNumber - 1) {
@@ -1536,11 +1536,11 @@ export class PieceTreeBase {
while (x !== SENTINEL) {
if (x.piece.lineFeedCnt > 0) {
let accumualtedValue = this.getAccumulatedValue(x, 0);
let accumulatedValue = this.getAccumulatedValue(x, 0);
let nodeStartOffset = this.offsetOfNode(x);
return {
node: x,
remainder: Math.min(column - 1, accumualtedValue),
remainder: Math.min(column - 1, accumulatedValue),
nodeStartOffset
};
} else {

View File

@@ -30,7 +30,6 @@ import { NULL_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/nullMode';
import { ignoreBracketsInToken } from 'vs/editor/common/modes/supports';
import { BracketsUtils, RichEditBracket, RichEditBrackets } from 'vs/editor/common/modes/supports/richEditBrackets';
import { ThemeColor } from 'vs/platform/theme/common/themeService';
import { withUndefinedAsNull } from 'vs/base/common/types';
import { VSBufferReadableStream, VSBuffer } from 'vs/base/common/buffer';
import { TokensStore, MultilineTokens, countEOL, MultilineTokens2, TokensStore2 } from 'vs/editor/common/model/tokensStore';
import { Color } from 'vs/base/common/color';
@@ -3185,8 +3184,8 @@ export class ModelDecorationOptions implements model.IModelDecorationOptions {
this.stickiness = options.stickiness || model.TrackedRangeStickiness.AlwaysGrowsWhenTypingAtEdges;
this.zIndex = options.zIndex || 0;
this.className = options.className ? cleanClassName(options.className) : null;
this.hoverMessage = withUndefinedAsNull(options.hoverMessage);
this.glyphMarginHoverMessage = withUndefinedAsNull(options.glyphMarginHoverMessage);
this.hoverMessage = options.hoverMessage || null;
this.glyphMarginHoverMessage = options.glyphMarginHoverMessage || null;
this.isWholeLine = options.isWholeLine || false;
this.showIfCollapsed = options.showIfCollapsed || false;
this.collapseOnReplaceEdit = options.collapseOnReplaceEdit || false;

View File

@@ -1413,19 +1413,27 @@ export interface AuthenticationSession {
id: string;
accessToken: string;
account: {
displayName: string;
label: string;
id: string;
}
scopes: string[];
scopes: ReadonlyArray<string>;
}
/**
* @internal
*/
export interface AuthenticationSessionsChangeEvent {
added: string[];
removed: string[];
changed: string[];
added: ReadonlyArray<string>;
removed: ReadonlyArray<string>;
changed: ReadonlyArray<string>;
}
/**
* @internal
*/
export interface AuthenticationProviderInformation {
id: string;
label: string;
}
export interface Command {

View File

@@ -7,8 +7,7 @@ import { Color } from 'vs/base/common/color';
import { Emitter, Event } from 'vs/base/common/event';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { ColorId, ITokenizationRegistry, ITokenizationSupport, ITokenizationSupportChangedEvent } from 'vs/editor/common/modes';
import { withUndefinedAsNull } from 'vs/base/common/types';
import { keys } from 'vs/base/common/map';
import { toArray } from 'vs/base/common/arrays';
export class TokenizationRegistryImpl implements ITokenizationRegistry {
@@ -77,13 +76,13 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
}
public get(language: string): ITokenizationSupport | null {
return withUndefinedAsNull(this._map.get(language));
return (this._map.get(language) || null);
}
public setColorMap(colorMap: Color[]): void {
this._colorMap = colorMap;
this._onDidChange.fire({
changedLanguages: keys(this._map),
changedLanguages: toArray(this._map.keys()),
changedColorMap: true
});
}

View File

@@ -15,7 +15,6 @@ import { NULL_LANGUAGE_IDENTIFIER, NULL_MODE_ID } from 'vs/editor/common/modes/n
import { ILanguageExtensionPoint } from 'vs/editor/common/services/modeService';
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { Registry } from 'vs/platform/registry/common/platform';
import { withUndefinedAsNull } from 'vs/base/common/types';
const hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -268,7 +267,7 @@ export class LanguagesRegistry extends Disposable {
return null;
}
const language = this._languages[modeId];
return withUndefinedAsNull(language.mimetypes[0]);
return (language.mimetypes[0] || null);
}
public extractModeIds(commaSeparatedMimetypesOrCommaSeparatedIds: string | undefined): string[] {

View File

@@ -12,11 +12,9 @@ import { themeColorFromId, ThemeColor } from 'vs/platform/theme/common/themeServ
import { overviewRulerWarning, overviewRulerInfo, overviewRulerError } from 'vs/editor/common/view/editorColorRegistry';
import { IModelService } from 'vs/editor/common/services/modelService';
import { Range } from 'vs/editor/common/core/range';
import { keys } from 'vs/base/common/map';
import { IMarkerDecorationsService } from 'vs/editor/common/services/markersDecorationService';
import { Schemas } from 'vs/base/common/network';
import { Emitter, Event } from 'vs/base/common/event';
import { withUndefinedAsNull } from 'vs/base/common/types';
import { minimapWarning, minimapError } from 'vs/platform/theme/common/colorRegistry';
import { Delayer } from 'vs/base/common/async';
@@ -33,7 +31,7 @@ class MarkerDecorations extends Disposable {
) {
super();
this._register(toDisposable(() => {
this.model.deltaDecorations(keys(this._markersData), []);
this.model.deltaDecorations([...this._markersData.keys()], []);
this._markersData.clear();
}));
}
@@ -43,7 +41,7 @@ class MarkerDecorations extends Disposable {
}
public update(markers: IMarker[], newDecorations: IModelDeltaDecoration[]): boolean {
const oldIds = keys(this._markersData);
const oldIds = [...this._markersData.keys()];
this._markersData.clear();
const ids = this.model.deltaDecorations(oldIds, newDecorations);
for (let index = 0; index < ids.length; index++) {
@@ -96,7 +94,7 @@ export class MarkerDecorationsService extends Disposable implements IMarkerDecor
getMarker(model: ITextModel, decoration: IModelDecoration): IMarker | null {
const markerDecorations = this._markerDecorations.get(MODEL_ID(model.uri));
return markerDecorations ? withUndefinedAsNull(markerDecorations.getMarker(decoration)) : null;
return markerDecorations ? (markerDecorations.getMarker(decoration) || null) : null;
}
getLiveMarkers(model: ITextModel): [Range, IMarker][] {