mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-12 19:18:32 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as childProcess from 'child_process';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { Readable } from 'stream';
|
||||
import { NodeStringDecoder, StringDecoder } from 'string_decoder';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
@@ -13,7 +13,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import * as normalization from 'vs/base/common/normalization';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import { isEqualOrParent } from 'vs/base/common/paths';
|
||||
import { isEqualOrParent } from 'vs/base/common/extpath';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { StopWatch } from 'vs/base/common/stopwatch';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
@@ -21,8 +21,7 @@ import * as types from 'vs/base/common/types';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as extfs from 'vs/base/node/extfs';
|
||||
import * as flow from 'vs/base/node/flow';
|
||||
import { IFileQuery, IFolderQuery, IProgress, ISearchEngineStats } from 'vs/platform/search/common/search';
|
||||
import { IRawFileMatch, ISearchEngine, ISearchEngineSuccess } from 'vs/workbench/services/search/node/search';
|
||||
import { IFileQuery, IFolderQuery, IProgress, ISearchEngineStats, IRawFileMatch, ISearchEngine, ISearchEngineSuccess } from 'vs/workbench/services/search/common/search';
|
||||
import { spawnRipgrepCmd } from './ripgrepFileSearch';
|
||||
|
||||
interface IDirectoryEntry {
|
||||
|
||||
@@ -3,15 +3,14 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import { StopWatch } from 'vs/base/common/stopwatch';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IFileMatch, IFileSearchProviderStats, IFolderQuery, ISearchCompleteStats, IFileQuery } from 'vs/platform/search/common/search';
|
||||
import { QueryGlobTester, resolvePatternsForProvider } from 'vs/workbench/services/search/node/search';
|
||||
import { IFileMatch, IFileSearchProviderStats, IFolderQuery, ISearchCompleteStats, IFileQuery, QueryGlobTester, resolvePatternsForProvider } from 'vs/workbench/services/search/common/search';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export interface IInternalFileMatch {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as gracefulFs from 'graceful-fs';
|
||||
import { join, sep } from 'path';
|
||||
import { join, sep } from 'vs/base/common/path';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import { CancelablePromise, createCancelablePromise } from 'vs/base/common/async';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
@@ -16,11 +16,10 @@ import { StopWatch } from 'vs/base/common/stopwatch';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { compareItemsByScore, IItemAccessor, prepareQuery, ScorerCache } from 'vs/base/parts/quickopen/common/quickOpenScorer';
|
||||
import { MAX_FILE_SIZE } from 'vs/platform/files/node/files';
|
||||
import { ICachedSearchStats, IFileQuery, IFileSearchStats, IFolderQuery, IProgress, IRawFileQuery, IRawQuery, IRawTextQuery, ITextQuery } from 'vs/platform/search/common/search';
|
||||
import { MAX_FILE_SIZE } from 'vs/platform/files/node/fileConstants';
|
||||
import { ICachedSearchStats, IFileQuery, IFileSearchStats, IFolderQuery, IProgress, IRawFileQuery, IRawQuery, IRawTextQuery, ITextQuery, IFileSearchProgressItem, IRawFileMatch, IRawSearchService, ISearchEngine, ISearchEngineSuccess, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, ISerializedSearchSuccess } from 'vs/workbench/services/search/common/search';
|
||||
import { Engine as FileSearchEngine } from 'vs/workbench/services/search/node/fileSearch';
|
||||
import { TextSearchEngineAdapter } from 'vs/workbench/services/search/node/textSearchAdapter';
|
||||
import { IFileSearchProgressItem, IRawFileMatch, IRawSearchService, ISearchEngine, ISearchEngineSuccess, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, ISerializedSearchSuccess } from './search';
|
||||
|
||||
gracefulFs.gracefulify(fs);
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as cp from 'child_process';
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import { normalizeNFD } from 'vs/base/common/normalization';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { isMacintosh as isMac } from 'vs/base/common/platform';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IFileQuery, IFolderQuery } from 'vs/platform/search/common/search';
|
||||
import { IFileQuery, IFolderQuery } from 'vs/workbench/services/search/common/search';
|
||||
import { anchorGlob } from 'vs/workbench/services/search/node/ripgrepSearchUtils';
|
||||
import { rgPath } from 'vscode-ripgrep';
|
||||
|
||||
@@ -159,7 +159,7 @@ function globExprsToRgGlobs(patterns: glob.IExpression, folder?: string, exclude
|
||||
* Exported for testing
|
||||
*/
|
||||
export function getAbsoluteGlob(folder: string, key: string): string {
|
||||
return paths.isAbsolute(key) ?
|
||||
return path.isAbsolute(key) ?
|
||||
key :
|
||||
path.join(folder, key);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ function trimTrailingSlash(str: string): string {
|
||||
}
|
||||
|
||||
export function fixDriveC(path: string): string {
|
||||
const root = paths.getRoot(path);
|
||||
const root = extpath.getRoot(path);
|
||||
return root.toLowerCase() === 'c:/' ?
|
||||
path.replace(/^c:[/\\]/i, '/') :
|
||||
path;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { SearchRange, TextSearchMatch } from 'vs/platform/search/common/search';
|
||||
import { SearchRange, TextSearchMatch } from 'vs/workbench/services/search/common/search';
|
||||
import * as vscode from 'vscode';
|
||||
import { mapArrayOrNot } from 'vs/base/common/arrays';
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
import * as cp from 'child_process';
|
||||
import { EventEmitter } from 'events';
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { NodeStringDecoder, StringDecoder } from 'string_decoder';
|
||||
import { createRegExp, startsWith, startsWithUTF8BOM, stripUTF8BOM, escapeRegExpCharacters, endsWith } from 'vs/base/common/strings';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IExtendedExtensionSearchOptions, SearchError, SearchErrorCode, serializeSearchError } from 'vs/platform/search/common/search';
|
||||
import { IExtendedExtensionSearchOptions, SearchError, SearchErrorCode, serializeSearchError } from 'vs/workbench/services/search/common/search';
|
||||
import * as vscode from 'vscode';
|
||||
import { rgPath } from 'vscode-ripgrep';
|
||||
import { anchorGlob, createTextSearchResult, IOutputChannel, Maybe, Range } from './ripgrepSearchUtils';
|
||||
|
||||
@@ -1,203 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import * as glob from 'vs/base/common/glob';
|
||||
import { IFileSearchStats, IFolderQuery, IProgress, IRawFileQuery, IRawTextQuery, ISearchEngineStats, ISearchQuery, ITextSearchMatch, ITextSearchStats, ITextSearchResult } from 'vs/platform/search/common/search';
|
||||
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
|
||||
|
||||
export interface ITelemetryEvent {
|
||||
eventName: string;
|
||||
data: ITelemetryData;
|
||||
}
|
||||
|
||||
export interface IRawSearchService {
|
||||
fileSearch(search: IRawFileQuery): Event<ISerializedSearchProgressItem | ISerializedSearchComplete>;
|
||||
textSearch(search: IRawTextQuery): Event<ISerializedSearchProgressItem | ISerializedSearchComplete>;
|
||||
clearCache(cacheKey: string): Promise<void>;
|
||||
}
|
||||
|
||||
export interface IRawFileMatch {
|
||||
base?: string;
|
||||
relativePath: string;
|
||||
basename: string;
|
||||
size?: number;
|
||||
}
|
||||
|
||||
export interface ISearchEngine<T> {
|
||||
search: (onResult: (matches: T) => void, onProgress: (progress: IProgress) => void, done: (error: Error | null, complete: ISearchEngineSuccess) => void) => void;
|
||||
cancel: () => void;
|
||||
}
|
||||
|
||||
export interface ISerializedSearchSuccess {
|
||||
type: 'success';
|
||||
limitHit: boolean;
|
||||
stats: IFileSearchStats | ITextSearchStats | null;
|
||||
}
|
||||
|
||||
export interface ISearchEngineSuccess {
|
||||
limitHit: boolean;
|
||||
stats: ISearchEngineStats;
|
||||
}
|
||||
|
||||
export interface ISerializedSearchError {
|
||||
type: 'error';
|
||||
error: {
|
||||
message: string,
|
||||
stack: string
|
||||
};
|
||||
}
|
||||
|
||||
export type ISerializedSearchComplete = ISerializedSearchSuccess | ISerializedSearchError;
|
||||
|
||||
export function isSerializedSearchComplete(arg: ISerializedSearchProgressItem | ISerializedSearchComplete): arg is ISerializedSearchComplete {
|
||||
if ((arg as any).type === 'error') {
|
||||
return true;
|
||||
} else if ((arg as any).type === 'success') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function isSerializedSearchSuccess(arg: ISerializedSearchComplete): arg is ISerializedSearchSuccess {
|
||||
return arg.type === 'success';
|
||||
}
|
||||
|
||||
export function isSerializedFileMatch(arg: ISerializedSearchProgressItem): arg is ISerializedFileMatch {
|
||||
return !!(<ISerializedFileMatch>arg).path;
|
||||
}
|
||||
|
||||
export interface ISerializedFileMatch {
|
||||
path?: string;
|
||||
results?: ITextSearchResult[];
|
||||
numMatches?: number;
|
||||
}
|
||||
|
||||
// Type of the possible values for progress calls from the engine
|
||||
export type ISerializedSearchProgressItem = ISerializedFileMatch | ISerializedFileMatch[] | IProgress;
|
||||
export type IFileSearchProgressItem = IRawFileMatch | IRawFileMatch[] | IProgress;
|
||||
|
||||
|
||||
export class FileMatch implements ISerializedFileMatch {
|
||||
path: string;
|
||||
results: ITextSearchMatch[];
|
||||
|
||||
constructor(path: string) {
|
||||
this.path = path;
|
||||
this.results = [];
|
||||
}
|
||||
|
||||
addMatch(match: ITextSearchMatch): void {
|
||||
this.results.push(match);
|
||||
}
|
||||
|
||||
serialize(): ISerializedFileMatch {
|
||||
return {
|
||||
path: this.path,
|
||||
results: this.results,
|
||||
numMatches: this.results.length
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the patterns that the provider handles. Discards sibling clauses and 'false' patterns
|
||||
*/
|
||||
export function resolvePatternsForProvider(globalPattern: glob.IExpression | undefined, folderPattern: glob.IExpression | undefined): string[] {
|
||||
const merged = {
|
||||
...(globalPattern || {}),
|
||||
...(folderPattern || {})
|
||||
};
|
||||
|
||||
return Object.keys(merged)
|
||||
.filter(key => {
|
||||
const value = merged[key];
|
||||
return typeof value === 'boolean' && value;
|
||||
});
|
||||
}
|
||||
|
||||
export class QueryGlobTester {
|
||||
|
||||
private _excludeExpression: glob.IExpression;
|
||||
private _parsedExcludeExpression: glob.ParsedExpression;
|
||||
|
||||
private _parsedIncludeExpression: glob.ParsedExpression;
|
||||
|
||||
constructor(config: ISearchQuery, folderQuery: IFolderQuery) {
|
||||
this._excludeExpression = {
|
||||
...(config.excludePattern || {}),
|
||||
...(folderQuery.excludePattern || {})
|
||||
};
|
||||
this._parsedExcludeExpression = glob.parse(this._excludeExpression);
|
||||
|
||||
// Empty includeExpression means include nothing, so no {} shortcuts
|
||||
let includeExpression: glob.IExpression | undefined = config.includePattern;
|
||||
if (folderQuery.includePattern) {
|
||||
if (includeExpression) {
|
||||
includeExpression = {
|
||||
...includeExpression,
|
||||
...folderQuery.includePattern
|
||||
};
|
||||
} else {
|
||||
includeExpression = folderQuery.includePattern;
|
||||
}
|
||||
}
|
||||
|
||||
if (includeExpression) {
|
||||
this._parsedIncludeExpression = glob.parse(includeExpression);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Guaranteed sync - siblingsFn should not return a promise.
|
||||
*/
|
||||
includedInQuerySync(testPath: string, basename?: string, hasSibling?: (name: string) => boolean): boolean {
|
||||
if (this._parsedExcludeExpression && this._parsedExcludeExpression(testPath, basename, hasSibling)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this._parsedIncludeExpression && !this._parsedIncludeExpression(testPath, basename, hasSibling)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Guaranteed async.
|
||||
*/
|
||||
includedInQuery(testPath: string, basename?: string, hasSibling?: (name: string) => boolean | Promise<boolean>): Promise<boolean> {
|
||||
const excludeP = this._parsedExcludeExpression ?
|
||||
Promise.resolve(this._parsedExcludeExpression(testPath, basename, hasSibling)).then(result => !!result) :
|
||||
Promise.resolve(false);
|
||||
|
||||
return excludeP.then(excluded => {
|
||||
if (excluded) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this._parsedIncludeExpression ?
|
||||
Promise.resolve(this._parsedIncludeExpression(testPath, basename, hasSibling)).then(result => !!result) :
|
||||
Promise.resolve(true);
|
||||
}).then(included => {
|
||||
return included;
|
||||
});
|
||||
}
|
||||
|
||||
hasSiblingExcludeClauses(): boolean {
|
||||
return hasSiblingClauses(this._excludeExpression);
|
||||
}
|
||||
}
|
||||
|
||||
function hasSiblingClauses(pattern: glob.IExpression): boolean {
|
||||
for (const key in pattern) {
|
||||
if (typeof pattern[key] !== 'boolean') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { ISearchHistoryValues, ISearchHistoryService } from 'vs/platform/search/common/search';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { isEmptyObject } from 'vs/base/common/types';
|
||||
|
||||
export class SearchHistoryService implements ISearchHistoryService {
|
||||
_serviceBrand: any;
|
||||
|
||||
private static readonly SEARCH_HISTORY_KEY = 'workbench.search.history';
|
||||
|
||||
private readonly _onDidClearHistory = new Emitter<void>();
|
||||
readonly onDidClearHistory: Event<void> = this._onDidClearHistory.event;
|
||||
|
||||
constructor(
|
||||
@IStorageService private readonly storageService: IStorageService
|
||||
) { }
|
||||
|
||||
clearHistory(): void {
|
||||
this.storageService.remove(SearchHistoryService.SEARCH_HISTORY_KEY, StorageScope.WORKSPACE);
|
||||
this._onDidClearHistory.fire();
|
||||
}
|
||||
|
||||
load(): ISearchHistoryValues {
|
||||
let result: ISearchHistoryValues | undefined;
|
||||
const raw = this.storageService.get(SearchHistoryService.SEARCH_HISTORY_KEY, StorageScope.WORKSPACE);
|
||||
|
||||
if (raw) {
|
||||
try {
|
||||
result = JSON.parse(raw);
|
||||
} catch (e) {
|
||||
// Invalid data
|
||||
}
|
||||
}
|
||||
|
||||
return result || {};
|
||||
}
|
||||
|
||||
save(history: ISearchHistoryValues): void {
|
||||
if (isEmptyObject(history)) {
|
||||
this.storageService.remove(SearchHistoryService.SEARCH_HISTORY_KEY, StorageScope.WORKSPACE);
|
||||
} else {
|
||||
this.storageService.store(SearchHistoryService.SEARCH_HISTORY_KEY, JSON.stringify(history), StorageScope.WORKSPACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IRawFileQuery, IRawTextQuery } from 'vs/platform/search/common/search';
|
||||
import { IRawSearchService, ISerializedSearchComplete, ISerializedSearchProgressItem } from './search';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IRawFileQuery, IRawTextQuery, IRawSearchService, ISerializedSearchComplete, ISerializedSearchProgressItem } from 'vs/workbench/services/search/common/search';
|
||||
|
||||
export class SearchChannel implements IServerChannel {
|
||||
|
||||
|
||||
@@ -11,25 +11,24 @@ import { Event } from 'vs/base/common/event';
|
||||
import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { keys, ResourceMap, values } from 'vs/base/common/map';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import { StopWatch } from 'vs/base/common/stopwatch';
|
||||
import { URI as uri } from 'vs/base/common/uri';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import { getNextTickChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IDebugParams, IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { deserializeSearchError, FileMatch, ICachedSearchStats, IFileMatch, IFileQuery, IFileSearchStats, IFolderQuery, IProgress, ISearchComplete, ISearchConfiguration, ISearchEngineStats, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, ITextQuery, pathIncludedInQuery, QueryType, SearchError, SearchErrorCode, SearchProviderType } from 'vs/platform/search/common/search';
|
||||
import { deserializeSearchError, FileMatch, ICachedSearchStats, IFileMatch, IFileQuery, IFileSearchStats, IFolderQuery, IProgress, ISearchComplete, ISearchEngineStats, ISearchProgressItem, ISearchQuery, ISearchResultProvider, ISearchService, ITextQuery, pathIncludedInQuery, QueryType, SearchError, SearchErrorCode, SearchProviderType, ISearchConfiguration, IRawSearchService, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, isSerializedSearchComplete, isSerializedSearchSuccess } from 'vs/workbench/services/search/common/search';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { addContextToEditorMatches, editorMatchesToTextSearchResults } from 'vs/workbench/services/search/common/searchHelpers';
|
||||
import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/untitledEditorService';
|
||||
import { IRawSearchService, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, isSerializedSearchComplete, isSerializedSearchSuccess } from './search';
|
||||
import { SearchChannelClient } from './searchIpc';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
|
||||
export class SearchService extends Disposable implements ISearchService {
|
||||
_serviceBrand: any;
|
||||
@@ -37,7 +36,6 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
private diskSearch: DiskSearch;
|
||||
private readonly fileSearchProviders = new Map<string, ISearchResultProvider>();
|
||||
private readonly textSearchProviders = new Map<string, ISearchResultProvider>();
|
||||
private readonly fileIndexProviders = new Map<string, ISearchResultProvider>();
|
||||
|
||||
constructor(
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@@ -46,12 +44,11 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
@IEditorService private readonly editorService: IEditorService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService
|
||||
) {
|
||||
super();
|
||||
this.diskSearch = this.instantiationService.createInstance(DiskSearch, !environmentService.isBuilt || environmentService.verbose, /*timeout=*/undefined, environmentService.debugSearch);
|
||||
this.diskSearch = this.instantiationService.createInstance(DiskSearch, !environmentService.isBuilt || environmentService.verbose, environmentService.debugSearch);
|
||||
}
|
||||
|
||||
registerSearchResultProvider(scheme: string, type: SearchProviderType, provider: ISearchResultProvider): IDisposable {
|
||||
@@ -60,8 +57,8 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
list = this.fileSearchProviders;
|
||||
} else if (type === SearchProviderType.text) {
|
||||
list = this.textSearchProviders;
|
||||
} else if (type === SearchProviderType.fileIndex) {
|
||||
list = this.fileIndexProviders;
|
||||
} else {
|
||||
throw new Error('Unknown SearchProviderType');
|
||||
}
|
||||
|
||||
list.set(scheme, provider);
|
||||
@@ -71,22 +68,6 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
});
|
||||
}
|
||||
|
||||
extendQuery(query: IFileQuery): void {
|
||||
const configuration = this.configurationService.getValue<ISearchConfiguration>();
|
||||
|
||||
// Configuration: File Excludes
|
||||
if (!query.disregardExcludeSettings) {
|
||||
const fileExcludes = objects.deepClone(configuration && configuration.files && configuration.files.exclude);
|
||||
if (fileExcludes) {
|
||||
if (!query.excludePattern) {
|
||||
query.excludePattern = fileExcludes;
|
||||
} else {
|
||||
objects.mixin(query.excludePattern, fileExcludes, false /* no overwrite */);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
textSearch(query: ITextQuery, token?: CancellationToken, onProgress?: (item: ISearchProgressItem) => void): Promise<ISearchComplete> {
|
||||
// Get local results from dirty/untitled
|
||||
const localResults = this.getLocalResults(query);
|
||||
@@ -95,8 +76,6 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
arrays.coalesce(localResults.values()).forEach(onProgress);
|
||||
}
|
||||
|
||||
this.logService.trace('SearchService#search', JSON.stringify(query));
|
||||
|
||||
const onProviderProgress = progress => {
|
||||
if (progress.resource) {
|
||||
// Match
|
||||
@@ -121,6 +100,8 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
}
|
||||
|
||||
private doSearch(query: ISearchQuery, token?: CancellationToken, onProgress?: (item: ISearchProgressItem) => void): Promise<ISearchComplete> {
|
||||
this.logService.trace('SearchService#search', JSON.stringify(query));
|
||||
|
||||
const schemesInQuery = this.getSchemesInQuery(query);
|
||||
|
||||
const providerActivations: Promise<any>[] = [Promise.resolve(null)];
|
||||
@@ -197,7 +178,7 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
keys(fqs).forEach(scheme => {
|
||||
const schemeFQs = fqs.get(scheme);
|
||||
const provider = query.type === QueryType.File ?
|
||||
this.fileSearchProviders.get(scheme) || this.fileIndexProviders.get(scheme) :
|
||||
this.fileSearchProviders.get(scheme) :
|
||||
this.textSearchProviders.get(scheme);
|
||||
|
||||
if (!provider && scheme === 'file') {
|
||||
@@ -339,7 +320,7 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
});
|
||||
}
|
||||
} else if (query.type === QueryType.Text) {
|
||||
let errorType: string;
|
||||
let errorType: string | undefined;
|
||||
if (err) {
|
||||
errorType = err.code === SearchErrorCode.regexParseError ? 'regex' :
|
||||
err.code === SearchErrorCode.unknownEncoding ? 'encoding' :
|
||||
@@ -436,7 +417,6 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
clearCache(cacheKey: string): Promise<void> {
|
||||
const clearPs = [
|
||||
this.diskSearch,
|
||||
...values(this.fileIndexProviders),
|
||||
...values(this.fileSearchProviders)
|
||||
].map(provider => provider && provider.clearCache(cacheKey));
|
||||
|
||||
@@ -446,19 +426,21 @@ export class SearchService extends Disposable implements ISearchService {
|
||||
}
|
||||
|
||||
export class DiskSearch implements ISearchResultProvider {
|
||||
_serviceBrand: any;
|
||||
|
||||
private raw: IRawSearchService;
|
||||
|
||||
constructor(
|
||||
verboseLogging: boolean,
|
||||
timeout: number = 60 * 60 * 1000,
|
||||
searchDebug: IDebugParams | undefined,
|
||||
@ILogService private readonly logService: ILogService
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IConfigurationService private readonly configService: IConfigurationService,
|
||||
) {
|
||||
const timeout = this.configService.getValue<ISearchConfiguration>().search.maintainFileSearchCache ?
|
||||
Number.MAX_VALUE :
|
||||
60 * 60 * 1000;
|
||||
|
||||
const opts: IIPCOptions = {
|
||||
serverName: 'Search',
|
||||
timeout: timeout,
|
||||
timeout,
|
||||
args: ['--type=searchService'],
|
||||
// See https://github.com/Microsoft/vscode/issues/27665
|
||||
// Pass in fresh execArgv to the forked process such that it doesn't inherit them from `process.execArgv`.
|
||||
@@ -600,3 +582,5 @@ export class DiskSearch implements ISearchResultProvider {
|
||||
return this.raw.clearCache(cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
registerSingleton(ISearchService, SearchService, true);
|
||||
@@ -5,10 +5,9 @@
|
||||
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import * as extfs from 'vs/base/node/extfs';
|
||||
import { IFileMatch, IProgress, ITextQuery, ITextSearchStats, ITextSearchMatch } from 'vs/platform/search/common/search';
|
||||
import { IFileMatch, IProgress, ITextQuery, ITextSearchStats, ITextSearchMatch, ISerializedFileMatch, ISerializedSearchSuccess } from 'vs/workbench/services/search/common/search';
|
||||
import { RipgrepTextSearchEngine } from 'vs/workbench/services/search/node/ripgrepTextSearchEngine';
|
||||
import { TextSearchManager } from 'vs/workbench/services/search/node/textSearchManager';
|
||||
import { ISerializedFileMatch, ISerializedSearchSuccess } from './search';
|
||||
|
||||
export class TextSearchEngineAdapter {
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { mapArrayOrNot } from 'vs/base/common/arrays';
|
||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
@@ -12,8 +12,7 @@ import * as resources from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { toCanonicalName } from 'vs/base/node/encoding';
|
||||
import * as extfs from 'vs/base/node/extfs';
|
||||
import { IExtendedExtensionSearchOptions, IFileMatch, IFolderQuery, IPatternInfo, ISearchCompleteStats, ITextQuery, ITextSearchContext, ITextSearchMatch, ITextSearchResult } from 'vs/platform/search/common/search';
|
||||
import { QueryGlobTester, resolvePatternsForProvider } from 'vs/workbench/services/search/node/search';
|
||||
import { IExtendedExtensionSearchOptions, IFileMatch, IFolderQuery, IPatternInfo, ISearchCompleteStats, ITextQuery, ITextSearchContext, ITextSearchMatch, ITextSearchResult, QueryGlobTester, resolvePatternsForProvider } from 'vs/workbench/services/search/common/search';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export class TextSearchManager {
|
||||
|
||||
Reference in New Issue
Block a user