mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 11:08:31 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -8,22 +8,22 @@
|
||||
import * as childProcess from 'child_process';
|
||||
import { StringDecoder, NodeStringDecoder } from 'string_decoder';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import fs = require('fs');
|
||||
import path = require('path');
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { isEqualOrParent } from 'vs/base/common/paths';
|
||||
import { Readable } from 'stream';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
|
||||
import objects = require('vs/base/common/objects');
|
||||
import arrays = require('vs/base/common/arrays');
|
||||
import platform = require('vs/base/common/platform');
|
||||
import strings = require('vs/base/common/strings');
|
||||
import types = require('vs/base/common/types');
|
||||
import glob = require('vs/base/common/glob');
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import { IProgress, IUncachedSearchStats } from 'vs/platform/search/common/search';
|
||||
|
||||
import extfs = require('vs/base/node/extfs');
|
||||
import flow = require('vs/base/node/flow');
|
||||
import * as extfs from 'vs/base/node/extfs';
|
||||
import * as flow from 'vs/base/node/flow';
|
||||
import { IRawFileMatch, ISerializedSearchComplete, IRawSearch, ISearchEngine, IFolderSearch } from './search';
|
||||
import { spawnRipgrepCmd } from './ripgrepFileSearch';
|
||||
import { rgErrorMsgForDisplay } from './ripgrepTextSearch';
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import fs = require('fs');
|
||||
import { isAbsolute, sep } from 'path';
|
||||
import * as fs from 'fs';
|
||||
import { isAbsolute, sep, join } from 'path';
|
||||
|
||||
import gracefulFs = require('graceful-fs');
|
||||
import * as gracefulFs from 'graceful-fs';
|
||||
gracefulFs.gracefulify(fs);
|
||||
|
||||
import arrays = require('vs/base/common/arrays');
|
||||
import objects = require('vs/base/common/objects');
|
||||
import strings = require('vs/base/common/strings');
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { PPromise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import { FileWalker, Engine as FileSearchEngine } from 'vs/workbench/services/search/node/fileSearch';
|
||||
import { MAX_FILE_SIZE } from 'vs/platform/files/node/files';
|
||||
@@ -22,7 +22,6 @@ import { Engine as TextSearchEngine } from 'vs/workbench/services/search/node/te
|
||||
import { TextSearchWorkerProvider } from 'vs/workbench/services/search/node/textSearchWorkerProvider';
|
||||
import { IRawSearchService, IRawSearch, IRawFileMatch, ISerializedFileMatch, ISerializedSearchProgressItem, ISerializedSearchComplete, ISearchEngine, IFileSearchProgressItem, ITelemetryEvent } from './search';
|
||||
import { ICachedSearchStats, IProgress } from 'vs/platform/search/common/search';
|
||||
import { fuzzyContains } from 'vs/base/common/strings';
|
||||
import { compareItemsByScore, IItemAccessor, ScorerCache, prepareQuery } from 'vs/base/parts/quickopen/common/quickOpenScorer';
|
||||
|
||||
export class SearchService implements IRawSearchService {
|
||||
@@ -133,7 +132,7 @@ export class SearchService implements IRawSearchService {
|
||||
}
|
||||
|
||||
private rawMatchToSearchItem(match: IRawFileMatch): ISerializedFileMatch {
|
||||
return { path: match.base ? [match.base, match.relativePath].join(sep) : match.relativePath };
|
||||
return { path: match.base ? join(match.base, match.relativePath) : match.relativePath };
|
||||
}
|
||||
|
||||
private doSortedSearch(engine: ISearchEngine<IRawFileMatch>, config: IRawSearch): PPromise<[ISerializedSearchComplete, IRawFileMatch[]], IProgress> {
|
||||
@@ -144,6 +143,7 @@ export class SearchService implements IRawSearchService {
|
||||
.then(result => {
|
||||
c([result, results]);
|
||||
if (this.telemetryPipe) {
|
||||
// __GDPR__TODO__ classify event
|
||||
this.telemetryPipe({
|
||||
eventName: 'fileSearch',
|
||||
data: result.stats
|
||||
@@ -310,7 +310,7 @@ export class SearchService implements IRawSearchService {
|
||||
let entry = cachedEntries[i];
|
||||
|
||||
// Check if this entry is a match for the search value
|
||||
if (!fuzzyContains(entry.relativePath, normalizedSearchValueLowercase)) {
|
||||
if (!strings.fuzzyContains(entry.relativePath, normalizedSearchValueLowercase)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,14 +32,29 @@ function getRgArgs(config: IRawSearch, folderQuery: IFolderSearch, includePatter
|
||||
|
||||
// includePattern can't have siblingClauses
|
||||
foldersToIncludeGlobs([folderQuery], includePattern, false).forEach(globArg => {
|
||||
args.push('-g', anchor(isMac ? normalizeNFD(globArg) : globArg));
|
||||
const inclusion = anchor(globArg);
|
||||
args.push('-g', inclusion);
|
||||
if (isMac) {
|
||||
const normalized = normalizeNFD(inclusion);
|
||||
if (normalized !== inclusion) {
|
||||
args.push('-g', normalized);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let siblingClauses: glob.IExpression;
|
||||
|
||||
const rgGlobs = foldersToRgExcludeGlobs([folderQuery], excludePattern, undefined, false);
|
||||
rgGlobs.globArgs
|
||||
.forEach(rgGlob => args.push('-g', `!${anchor(isMac ? normalizeNFD(rgGlob) : rgGlob)}`));
|
||||
rgGlobs.globArgs.forEach(globArg => {
|
||||
const exclusion = `!${anchor(globArg)}`;
|
||||
args.push('-g', exclusion);
|
||||
if (isMac) {
|
||||
const normalized = normalizeNFD(exclusion);
|
||||
if (normalized !== exclusion) {
|
||||
args.push('-g', normalized);
|
||||
}
|
||||
}
|
||||
});
|
||||
siblingClauses = rgGlobs.siblingClauses;
|
||||
|
||||
if (folderQuery.disregardIgnoreFiles !== false) {
|
||||
|
||||
@@ -11,8 +11,8 @@ import { StringDecoder, NodeStringDecoder } from 'string_decoder';
|
||||
import * as cp from 'child_process';
|
||||
import { rgPath } from 'vscode-ripgrep';
|
||||
|
||||
import objects = require('vs/base/common/objects');
|
||||
import platform = require('vs/base/common/platform');
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extfs from 'vs/base/node/extfs';
|
||||
@@ -29,7 +29,7 @@ const rgDiskPath = rgPath.replace(/\bnode_modules\.asar\b/, 'node_modules.asar.u
|
||||
export class RipgrepEngine {
|
||||
private isDone = false;
|
||||
private rgProc: cp.ChildProcess;
|
||||
private killRgProcFn: Function;
|
||||
private killRgProcFn: (code?: number) => void;
|
||||
private postProcessExclusions: glob.ParsedExpression;
|
||||
|
||||
private ripgrepParser: RipgrepParser;
|
||||
@@ -169,11 +169,11 @@ export function rgErrorMsgForDisplay(msg: string): string | undefined {
|
||||
}
|
||||
|
||||
export class RipgrepParser extends EventEmitter {
|
||||
private static readonly RESULT_REGEX = /^\u001b\[m(\d+)\u001b\[m:(.*)(\r?)/;
|
||||
private static readonly FILE_REGEX = /^\u001b\[m(.+)\u001b\[m$/;
|
||||
private static readonly RESULT_REGEX = /^\u001b\[0m(\d+)\u001b\[0m:(.*)(\r?)/;
|
||||
private static readonly FILE_REGEX = /^\u001b\[0m(.+)\u001b\[0m$/;
|
||||
|
||||
public static readonly MATCH_START_MARKER = '\u001b[m\u001b[31m';
|
||||
public static readonly MATCH_END_MARKER = '\u001b[m';
|
||||
public static readonly MATCH_START_MARKER = '\u001b[0m\u001b[31m';
|
||||
public static readonly MATCH_END_MARKER = '\u001b[0m';
|
||||
|
||||
private fileMatch: FileMatch;
|
||||
private remainder: string;
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
import { PPromise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import uri from 'vs/base/common/uri';
|
||||
import objects = require('vs/base/common/objects');
|
||||
import strings = require('vs/base/common/strings');
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp';
|
||||
import { IProgress, LineMatch, FileMatch, ISearchComplete, ISearchProgressItem, QueryType, IFileMatch, ISearchQuery, IFolderQuery, ISearchConfiguration, ISearchService, pathIncludedInQuery, ISearchResultProvider } from 'vs/platform/search/common/search';
|
||||
|
||||
@@ -6,16 +6,14 @@
|
||||
'use strict';
|
||||
|
||||
import * as fs from 'fs';
|
||||
import gracefulFs = require('graceful-fs');
|
||||
import * as gracefulFs from 'graceful-fs';
|
||||
gracefulFs.gracefulify(fs);
|
||||
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { LineMatch, FileMatch } from '../search';
|
||||
import * as baseMime from 'vs/base/common/mime';
|
||||
import { UTF16le, UTF16be, UTF8, UTF8_with_bom, encodingExists, decode, bomLength } from 'vs/base/node/encoding';
|
||||
import { detectMimeAndEncodingFromBuffer } from 'vs/base/node/mime';
|
||||
import { UTF16le, UTF16be, UTF8, UTF8_with_bom, encodingExists, decode, bomLength, detectEncodingFromBuffer } from 'vs/base/node/encoding';
|
||||
|
||||
import { ISearchWorker, ISearchWorkerSearchArgs, ISearchWorkerSearchResult } from './searchWorkerIpc';
|
||||
|
||||
@@ -208,13 +206,13 @@ export class SearchWorkerEngine {
|
||||
|
||||
// Detect encoding and mime when this is the beginning of the file
|
||||
if (isFirstRead) {
|
||||
const mimeAndEncoding = detectMimeAndEncodingFromBuffer({ buffer, bytesRead }, false);
|
||||
if (mimeAndEncoding.mimes[mimeAndEncoding.mimes.length - 1] !== baseMime.MIME_TEXT) {
|
||||
const detected = detectEncodingFromBuffer({ buffer, bytesRead }, false);
|
||||
if (detected.seemsBinary) {
|
||||
return clb(null); // skip files that seem binary
|
||||
}
|
||||
|
||||
// Check for BOM offset
|
||||
switch (mimeAndEncoding.encoding) {
|
||||
switch (detected.encoding) {
|
||||
case UTF8:
|
||||
pos = i = bomLength(UTF8);
|
||||
options.encoding = UTF8;
|
||||
|
||||
Reference in New Issue
Block a user