mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode cfc1ab4c5f816765b91fb7ead3c3427a7c8581a3
This commit is contained in:
@@ -3053,6 +3053,7 @@ export class ModelDecorationOptions implements model.IModelDecorationOptions {
|
||||
readonly minimap: ModelDecorationMinimapOptions | null;
|
||||
readonly glyphMarginClassName: string | null;
|
||||
readonly linesDecorationsClassName: string | null;
|
||||
readonly firstLineDecorationClassName: string | null;
|
||||
readonly marginClassName: string | null;
|
||||
readonly inlineClassName: string | null;
|
||||
readonly inlineClassNameAffectsLetterSpacing: boolean;
|
||||
@@ -3072,6 +3073,7 @@ export class ModelDecorationOptions implements model.IModelDecorationOptions {
|
||||
this.minimap = options.minimap ? new ModelDecorationMinimapOptions(options.minimap) : null;
|
||||
this.glyphMarginClassName = options.glyphMarginClassName ? cleanClassName(options.glyphMarginClassName) : null;
|
||||
this.linesDecorationsClassName = options.linesDecorationsClassName ? cleanClassName(options.linesDecorationsClassName) : null;
|
||||
this.firstLineDecorationClassName = options.firstLineDecorationClassName ? cleanClassName(options.firstLineDecorationClassName) : null;
|
||||
this.marginClassName = options.marginClassName ? cleanClassName(options.marginClassName) : null;
|
||||
this.inlineClassName = options.inlineClassName ? cleanClassName(options.inlineClassName) : null;
|
||||
this.inlineClassNameAffectsLetterSpacing = options.inlineClassNameAffectsLetterSpacing || false;
|
||||
|
||||
@@ -515,7 +515,7 @@ export class Searcher {
|
||||
private _prevMatchStartIndex: number;
|
||||
private _prevMatchLength: number;
|
||||
|
||||
constructor(wordSeparators: WordCharacterClassifier | null, searchRegex: RegExp, ) {
|
||||
constructor(wordSeparators: WordCharacterClassifier | null, searchRegex: RegExp,) {
|
||||
this._wordSeparators = wordSeparators;
|
||||
this._searchRegex = searchRegex;
|
||||
this._prevMatchStartIndex = -1;
|
||||
|
||||
@@ -781,6 +781,17 @@ export class TokensStore2 {
|
||||
|
||||
let aIndex = 0;
|
||||
let result: number[] = [], resultLen = 0;
|
||||
let lastEndOffset = 0;
|
||||
|
||||
const emitToken = (endOffset: number, metadata: number) => {
|
||||
if (endOffset === lastEndOffset) {
|
||||
return;
|
||||
}
|
||||
lastEndOffset = endOffset;
|
||||
result[resultLen++] = endOffset;
|
||||
result[resultLen++] = metadata;
|
||||
};
|
||||
|
||||
for (let bIndex = 0; bIndex < bLen; bIndex++) {
|
||||
const bStartCharacter = bTokens.getStartCharacter(bIndex);
|
||||
const bEndCharacter = bTokens.getEndCharacter(bIndex);
|
||||
@@ -797,42 +808,36 @@ export class TokensStore2 {
|
||||
|
||||
// push any token from `a` that is before `b`
|
||||
while (aIndex < aLen && aTokens.getEndOffset(aIndex) <= bStartCharacter) {
|
||||
result[resultLen++] = aTokens.getEndOffset(aIndex);
|
||||
result[resultLen++] = aTokens.getMetadata(aIndex);
|
||||
emitToken(aTokens.getEndOffset(aIndex), aTokens.getMetadata(aIndex));
|
||||
aIndex++;
|
||||
}
|
||||
|
||||
// push the token from `a` if it intersects the token from `b`
|
||||
if (aIndex < aLen && aTokens.getStartOffset(aIndex) < bStartCharacter) {
|
||||
result[resultLen++] = bStartCharacter;
|
||||
result[resultLen++] = aTokens.getMetadata(aIndex);
|
||||
emitToken(bStartCharacter, aTokens.getMetadata(aIndex));
|
||||
}
|
||||
|
||||
// skip any tokens from `a` that are contained inside `b`
|
||||
while (aIndex < aLen && aTokens.getEndOffset(aIndex) < bEndCharacter) {
|
||||
result[resultLen++] = aTokens.getEndOffset(aIndex);
|
||||
result[resultLen++] = (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask);
|
||||
emitToken(aTokens.getEndOffset(aIndex), (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask));
|
||||
aIndex++;
|
||||
}
|
||||
|
||||
if (aIndex < aLen && aTokens.getEndOffset(aIndex) === bEndCharacter) {
|
||||
// `a` ends exactly at the same spot as `b`!
|
||||
result[resultLen++] = aTokens.getEndOffset(aIndex);
|
||||
result[resultLen++] = (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask);
|
||||
emitToken(aTokens.getEndOffset(aIndex), (aTokens.getMetadata(aIndex) & aMask) | (bMetadata & bMask));
|
||||
aIndex++;
|
||||
} else {
|
||||
const aMergeIndex = Math.min(Math.max(0, aIndex - 1), aLen - 1);
|
||||
|
||||
// push the token from `b`
|
||||
result[resultLen++] = bEndCharacter;
|
||||
result[resultLen++] = (aTokens.getMetadata(aMergeIndex) & aMask) | (bMetadata & bMask);
|
||||
emitToken(bEndCharacter, (aTokens.getMetadata(aMergeIndex) & aMask) | (bMetadata & bMask));
|
||||
}
|
||||
}
|
||||
|
||||
// push the remaining tokens from `a`
|
||||
while (aIndex < aLen) {
|
||||
result[resultLen++] = aTokens.getEndOffset(aIndex);
|
||||
result[resultLen++] = aTokens.getMetadata(aIndex);
|
||||
emitToken(aTokens.getEndOffset(aIndex), aTokens.getMetadata(aIndex));
|
||||
aIndex++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user