提交 1bf16e11 编写于 作者: R Rob Lourens

Add onSearch activationEvent for search providers

上级 503b6908
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
}, },
"scripts": {}, "scripts": {},
"activationEvents": [ "activationEvents": [
"onSearch:file",
"*" "*"
], ],
"main": "./out/extension", "main": "./out/extension",
......
...@@ -220,6 +220,11 @@ const schema: IJSONSchema = { ...@@ -220,6 +220,11 @@ const schema: IJSONSchema = {
description: nls.localize('vscode.extension.activationEvents.workspaceContains', 'An activation event emitted whenever a folder is opened that contains at least a file matching the specified glob pattern.'), description: nls.localize('vscode.extension.activationEvents.workspaceContains', 'An activation event emitted whenever a folder is opened that contains at least a file matching the specified glob pattern.'),
body: 'workspaceContains:${4:filePattern}' body: 'workspaceContains:${4:filePattern}'
}, },
{
label: 'onSearch',
description: nls.localize('vscode.extension.activationEvents.onSearch', 'An activation event emitted whenever a search is started in the folder with the given scheme.'),
body: 'onSearch:${7:scheme}'
},
{ {
label: 'onView', label: 'onView',
body: 'onView:${5:viewId}', body: 'onView:${5:viewId}',
......
...@@ -125,7 +125,10 @@ export class SearchService implements ISearchService { ...@@ -125,7 +125,10 @@ export class SearchService implements ISearchService {
} }
}); });
const providerPromise = this.extensionService.whenInstalledExtensionsRegistered().then(() => { const schemesInQuery = query.folderQueries.map(fq => fq.folder.scheme);
const providerActivations = schemesInQuery.map(scheme => this.extensionService.activateByEvent(`onSearch:${scheme}`));
const providerPromise = TPromise.join(providerActivations).then(() => {
// TODO@roblou this is not properly waiting for search-rg to finish registering itself // TODO@roblou this is not properly waiting for search-rg to finish registering itself
// If no search provider has been registered for the 'file' schema, fall back on DiskSearch // If no search provider has been registered for the 'file' schema, fall back on DiskSearch
const providers = [ const providers = [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册