mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 01:25:38 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -56,7 +56,7 @@ export function format(value: string, ...args: any[]): string {
|
||||
* being used e.g. in HTMLElement.innerHTML.
|
||||
*/
|
||||
export function escape(html: string): string {
|
||||
return html.replace(/[<|>|&]/g, function (match) {
|
||||
return html.replace(/[<>&]/g, function (match) {
|
||||
switch (match) {
|
||||
case '<': return '<';
|
||||
case '>': return '>';
|
||||
@@ -188,6 +188,7 @@ export interface RegExpOptions {
|
||||
wholeWord?: boolean;
|
||||
multiline?: boolean;
|
||||
global?: boolean;
|
||||
unicode?: boolean;
|
||||
}
|
||||
|
||||
export function createRegExp(searchString: string, isRegex: boolean, options: RegExpOptions = {}): RegExp {
|
||||
@@ -215,6 +216,9 @@ export function createRegExp(searchString: string, isRegex: boolean, options: Re
|
||||
if (options.multiline) {
|
||||
modifiers += 'm';
|
||||
}
|
||||
if (options.unicode) {
|
||||
modifiers += 'u';
|
||||
}
|
||||
|
||||
return new RegExp(searchString, modifiers);
|
||||
}
|
||||
@@ -236,6 +240,13 @@ export function regExpContainsBackreference(regexpValue: string): boolean {
|
||||
return !!regexpValue.match(/([^\\]|^)(\\\\)*\\\d+/);
|
||||
}
|
||||
|
||||
export function regExpFlags(regexp: RegExp): string {
|
||||
return (regexp.global ? 'g' : '')
|
||||
+ (regexp.ignoreCase ? 'i' : '')
|
||||
+ (regexp.multiline ? 'm' : '')
|
||||
+ ((regexp as any).unicode ? 'u' : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns first index of the string that is not whitespace.
|
||||
* If string is empty or contains only whitespaces, returns -1
|
||||
|
||||
Reference in New Issue
Block a user