mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Merge from vscode 0f73473c08055054f317c1c94502f7f39fdbb164 (#6892)
* Merge from vscode 0f73473c08055054f317c1c94502f7f39fdbb164 * fix tslinting
This commit is contained in:
@@ -1202,5 +1202,8 @@ export function asDomUri(uri: URI): URI {
|
||||
* returns url('...')
|
||||
*/
|
||||
export function asCSSUrl(uri: URI): string {
|
||||
if (!uri) {
|
||||
return `url('')`;
|
||||
}
|
||||
return `url('${asDomUri(uri).toString(true).replace(/'/g, '%27')}')`;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,15 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { Iterator, IteratorResult, FIN } from './iterator';
|
||||
|
||||
|
||||
export function fromArray<T>(array: readonly T[]): Set<T> {
|
||||
const result = new Set<T>();
|
||||
for (const element of array) {
|
||||
result.add(element);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function values<V = any>(set: Set<V>): V[];
|
||||
export function values<K = any, V = any>(map: Map<K, V>): V[];
|
||||
export function values<V>(forEachable: { forEach(callback: (value: V, ...more: any[]) => any): void }): V[] {
|
||||
|
||||
@@ -12,7 +12,11 @@ export function buildReplaceStringWithCasePreserved(matches: string[] | null, pa
|
||||
} else if (matches[0].toLowerCase() === matches[0]) {
|
||||
return pattern.toLowerCase();
|
||||
} else if (strings.containsUppercaseCharacter(matches[0][0])) {
|
||||
return pattern[0].toUpperCase() + pattern.substr(1);
|
||||
if (validateSpecificSpecialCharacter(matches, pattern, '-')) {
|
||||
return buildReplaceStringForSpecificSpecialCharacter(matches, pattern, '-');
|
||||
} else {
|
||||
return pattern[0].toUpperCase() + pattern.substr(1);
|
||||
}
|
||||
} else {
|
||||
// we don't understand its pattern yet.
|
||||
return pattern;
|
||||
@@ -21,3 +25,19 @@ export function buildReplaceStringWithCasePreserved(matches: string[] | null, pa
|
||||
return pattern;
|
||||
}
|
||||
}
|
||||
|
||||
function validateSpecificSpecialCharacter(matches: string[], pattern: string, specialCharacter: string): boolean {
|
||||
const doesConatinSpecialCharacter = matches[0].indexOf(specialCharacter) !== -1 && pattern.indexOf(specialCharacter) !== -1;
|
||||
return doesConatinSpecialCharacter && matches[0].split(specialCharacter).length === pattern.split(specialCharacter).length;
|
||||
}
|
||||
|
||||
function buildReplaceStringForSpecificSpecialCharacter(matches: string[], pattern: string, specialCharacter: string): string {
|
||||
const splitPatternAtSpecialCharacter = pattern.split(specialCharacter);
|
||||
const splitMatchAtSpecialCharacter = matches[0].split(specialCharacter);
|
||||
let replaceString: string = '';
|
||||
splitPatternAtSpecialCharacter.forEach((splitValue, index) => {
|
||||
replaceString += buildReplaceStringWithCasePreserved([splitMatchAtSpecialCharacter[index]], splitValue) + specialCharacter;
|
||||
});
|
||||
|
||||
return replaceString.slice(0, -1);
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ suite('Keytar', () => {
|
||||
}
|
||||
})().then(done, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user