mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -5,10 +5,9 @@
|
||||
'use strict';
|
||||
|
||||
import arrays = require('vs/base/common/arrays');
|
||||
import objects = require('vs/base/common/objects');
|
||||
import strings = require('vs/base/common/strings');
|
||||
import paths = require('vs/base/common/paths');
|
||||
import { BoundedMap } from 'vs/base/common/map';
|
||||
import { LRUCache } from 'vs/base/common/map';
|
||||
import { CharCode } from 'vs/base/common/charCode';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
@@ -19,16 +18,13 @@ export interface IExpression {
|
||||
export interface IRelativePattern {
|
||||
base: string;
|
||||
pattern: string;
|
||||
pathToRelative(from: string, to: string): string;
|
||||
}
|
||||
|
||||
export function getEmptyExpression(): IExpression {
|
||||
return Object.create(null);
|
||||
}
|
||||
|
||||
export function mergeExpressions(...expressions: IExpression[]): IExpression {
|
||||
return objects.assign(getEmptyExpression(), ...expressions.filter(expr => !!expr));
|
||||
}
|
||||
|
||||
export interface SiblingClause {
|
||||
when: string;
|
||||
}
|
||||
@@ -152,17 +148,28 @@ function parseRegExp(pattern: string): string {
|
||||
}
|
||||
|
||||
// Support brackets
|
||||
if (char !== ']' && inBrackets) {
|
||||
if (inBrackets && (char !== ']' || !bracketVal) /* ] is literally only allowed as first character in brackets to match it */) {
|
||||
let res: string;
|
||||
switch (char) {
|
||||
case '-': // allow the range operator
|
||||
res = char;
|
||||
break;
|
||||
case '^': // allow the negate operator
|
||||
res = char;
|
||||
break;
|
||||
default:
|
||||
res = strings.escapeRegExpCharacters(char);
|
||||
|
||||
// range operator
|
||||
if (char === '-') {
|
||||
res = char;
|
||||
}
|
||||
|
||||
// negation operator (only valid on first index in bracket)
|
||||
else if ((char === '^' || char === '!') && !bracketVal) {
|
||||
res = '^';
|
||||
}
|
||||
|
||||
// glob split matching is not allowed within character ranges
|
||||
// see http://man7.org/linux/man-pages/man7/glob.7.html
|
||||
else if (char === GLOB_SPLIT) {
|
||||
res = '';
|
||||
}
|
||||
|
||||
// anything else gets escaped
|
||||
else {
|
||||
res = strings.escapeRegExpCharacters(char);
|
||||
}
|
||||
|
||||
bracketVal += res;
|
||||
@@ -261,7 +268,7 @@ interface ParsedExpressionPattern {
|
||||
allPaths?: string[];
|
||||
}
|
||||
|
||||
const CACHE = new BoundedMap<ParsedStringPattern>(10000); // bounded to 10000 elements
|
||||
const CACHE = new LRUCache<string, ParsedStringPattern>(10000); // bounded to 10000 elements
|
||||
|
||||
const FALSE = function () {
|
||||
return false;
|
||||
@@ -332,7 +339,7 @@ function wrapRelativePattern(parsedPattern: ParsedStringPattern, arg2: string |
|
||||
return null;
|
||||
}
|
||||
|
||||
return parsedPattern(paths.relative(arg2.base, path), basename);
|
||||
return parsedPattern(paths.normalize(arg2.pathToRelative(arg2.base, path)), basename);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -471,10 +478,10 @@ export function parse(arg1: string | IExpression | IRelativePattern, options: IG
|
||||
return parsedExpression(<IExpression>arg1, options);
|
||||
}
|
||||
|
||||
function isRelativePattern(obj: any): obj is IRelativePattern {
|
||||
export function isRelativePattern(obj: any): obj is IRelativePattern {
|
||||
const rp = obj as IRelativePattern;
|
||||
|
||||
return typeof rp.base === 'string' && typeof rp.pattern === 'string';
|
||||
return rp && typeof rp.base === 'string' && typeof rp.pattern === 'string' && typeof rp.pathToRelative === 'function';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -482,7 +489,7 @@ function isRelativePattern(obj: any): obj is IRelativePattern {
|
||||
*/
|
||||
export function parseToAsync(expression: IExpression, options?: IGlobOptions): ParsedExpression {
|
||||
const parsedExpression = parse(expression, options);
|
||||
return (path: string, basename?: string, siblingsFn?: () => TPromise<string[]>): TPromise<string> => {
|
||||
return (path: string, basename?: string, siblingsFn?: () => string[] | TPromise<string[]>): string | TPromise<string> => {
|
||||
const result = parsedExpression(path, basename, siblingsFn);
|
||||
return result instanceof TPromise ? result : TPromise.as(result);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user