mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 52dcb723a39ae75bee1bd56b3312d7fcdc87aeed (#6719)
This commit is contained in:
@@ -7,8 +7,8 @@ import { CharCode } from 'vs/base/common/charCode';
|
||||
import { ITextBuffer } from 'vs/editor/common/model';
|
||||
|
||||
class SpacesDiffResult {
|
||||
public spacesDiff: number;
|
||||
public looksLikeAlignment: boolean;
|
||||
public spacesDiff: number = 0;
|
||||
public looksLikeAlignment: boolean = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,8 +158,19 @@ export function guessIndentation(source: ITextBuffer, defaultTabSize: number, de
|
||||
spacesDiff(previousLineText, previousLineIndentation, currentLineText, currentLineIndentation, tmp);
|
||||
|
||||
if (tmp.looksLikeAlignment) {
|
||||
// skip this line entirely
|
||||
continue;
|
||||
// if defaultInsertSpaces === true && the spaces count == tabSize, we may want to count it as valid indentation
|
||||
//
|
||||
// - item1
|
||||
// - item2
|
||||
//
|
||||
// otherwise skip this line entirely
|
||||
//
|
||||
// const a = 1,
|
||||
// b = 2;
|
||||
|
||||
if (!(defaultInsertSpaces && defaultTabSize === tmp.spacesDiff)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
let currentSpacesDiff = tmp.spacesDiff;
|
||||
|
||||
@@ -265,16 +265,16 @@ class PieceTreeSearchCache {
|
||||
}
|
||||
|
||||
export class PieceTreeBase {
|
||||
root: TreeNode;
|
||||
protected _buffers: StringBuffer[]; // 0 is change buffer, others are readonly original buffer.
|
||||
protected _lineCnt: number;
|
||||
protected _length: number;
|
||||
protected _EOL: string;
|
||||
protected _EOLLength: number;
|
||||
protected _EOLNormalized: boolean;
|
||||
private _lastChangeBufferPos: BufferCursor;
|
||||
private _searchCache: PieceTreeSearchCache;
|
||||
private _lastVisitedLine: { lineNumber: number; value: string; };
|
||||
root!: TreeNode;
|
||||
protected _buffers!: StringBuffer[]; // 0 is change buffer, others are readonly original buffer.
|
||||
protected _lineCnt!: number;
|
||||
protected _length!: number;
|
||||
protected _EOL!: string;
|
||||
protected _EOLLength!: number;
|
||||
protected _EOLNormalized!: boolean;
|
||||
private _lastChangeBufferPos!: BufferCursor;
|
||||
private _searchCache!: PieceTreeSearchCache;
|
||||
private _lastVisitedLine!: { lineNumber: number; value: string; };
|
||||
|
||||
constructor(chunks: StringBuffer[], eol: '\r\n' | '\n', eolNormalized: boolean) {
|
||||
this.create(chunks, eol, eolNormalized);
|
||||
|
||||
@@ -329,7 +329,9 @@ export class TextModel extends Disposable implements model.ITextModel {
|
||||
|
||||
this._isTooLargeForSyncing = (bufferTextLength > TextModel.MODEL_SYNC_LIMIT);
|
||||
|
||||
this._setVersionId(1);
|
||||
this._versionId = 1;
|
||||
this._alternativeVersionId = 1;
|
||||
|
||||
this._isDisposed = false;
|
||||
this._isDisposing = false;
|
||||
|
||||
@@ -693,11 +695,7 @@ export class TextModel extends Disposable implements model.ITextModel {
|
||||
}
|
||||
|
||||
private _increaseVersionId(): void {
|
||||
this._setVersionId(this._versionId + 1);
|
||||
}
|
||||
|
||||
private _setVersionId(newVersionId: number): void {
|
||||
this._versionId = newVersionId;
|
||||
this._versionId = this._versionId + 1;
|
||||
this._alternativeVersionId = this._versionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,10 @@ export class TokenizationStateStore {
|
||||
private _invalidLineStartIndex: number;
|
||||
|
||||
constructor() {
|
||||
this._reset(null);
|
||||
this._beginState = [];
|
||||
this._valid = [];
|
||||
this._len = 0;
|
||||
this._invalidLineStartIndex = 0;
|
||||
}
|
||||
|
||||
private _reset(initialState: IState | null): void {
|
||||
|
||||
Reference in New Issue
Block a user