mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)
* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 * Fix breaks * Extension management fixes * Fix breaks in windows bundling * Fix/skip failing tests * Update distro * Add clear to nuget.config * Add hygiene task * Bump distro * Fix hygiene issue * Add build to hygiene exclusion * Update distro * Update hygiene * Hygiene exclusions * Update tsconfig * Bump distro for server breaks * Update build config * Update darwin path * Add done calls to notebook tests * Skip failing tests * Disable smoke tests
This commit is contained in:
@@ -289,3 +289,46 @@ export class StandardAutoClosingPairConditional {
|
||||
return (this._standardTokenMask & <number>standardToken) === 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export class AutoClosingPairs {
|
||||
// it is useful to be able to get pairs using either end of open and close
|
||||
|
||||
/** Key is first character of open */
|
||||
public readonly autoClosingPairsOpenByStart: Map<string, StandardAutoClosingPairConditional[]>;
|
||||
/** Key is last character of open */
|
||||
public readonly autoClosingPairsOpenByEnd: Map<string, StandardAutoClosingPairConditional[]>;
|
||||
/** Key is first character of close */
|
||||
public readonly autoClosingPairsCloseByStart: Map<string, StandardAutoClosingPairConditional[]>;
|
||||
/** Key is last character of close */
|
||||
public readonly autoClosingPairsCloseByEnd: Map<string, StandardAutoClosingPairConditional[]>;
|
||||
/** Key is close. Only has pairs that are a single character */
|
||||
public readonly autoClosingPairsCloseSingleChar: Map<string, StandardAutoClosingPairConditional[]>;
|
||||
|
||||
constructor(autoClosingPairs: StandardAutoClosingPairConditional[]) {
|
||||
this.autoClosingPairsOpenByStart = new Map<string, StandardAutoClosingPairConditional[]>();
|
||||
this.autoClosingPairsOpenByEnd = new Map<string, StandardAutoClosingPairConditional[]>();
|
||||
this.autoClosingPairsCloseByStart = new Map<string, StandardAutoClosingPairConditional[]>();
|
||||
this.autoClosingPairsCloseByEnd = new Map<string, StandardAutoClosingPairConditional[]>();
|
||||
this.autoClosingPairsCloseSingleChar = new Map<string, StandardAutoClosingPairConditional[]>();
|
||||
for (const pair of autoClosingPairs) {
|
||||
appendEntry(this.autoClosingPairsOpenByStart, pair.open.charAt(0), pair);
|
||||
appendEntry(this.autoClosingPairsOpenByEnd, pair.open.charAt(pair.open.length - 1), pair);
|
||||
appendEntry(this.autoClosingPairsCloseByStart, pair.close.charAt(0), pair);
|
||||
appendEntry(this.autoClosingPairsCloseByEnd, pair.close.charAt(pair.close.length - 1), pair);
|
||||
if (pair.close.length === 1 && pair.open.length === 1) {
|
||||
appendEntry(this.autoClosingPairsCloseSingleChar, pair.close, pair);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function appendEntry<K, V>(target: Map<K, V[]>, key: K, value: V): void {
|
||||
if (target.has(key)) {
|
||||
target.get(key)!.push(value);
|
||||
} else {
|
||||
target.set(key, [value]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user