mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
prefix stack with extension id, #32766
This commit is contained in:
@@ -18,6 +18,8 @@ import { MainContext, MainThreadExtensionServiceShape, IWorkspaceData, IEnvironm
|
||||
import { IExtensionMemento, ExtensionsActivator, ActivatedExtension, IExtensionAPI, IExtensionContext, EmptyExtension, IExtensionModule } from "vs/workbench/api/node/extHostExtensionActivator";
|
||||
import { Barrier } from "vs/workbench/services/extensions/node/barrier";
|
||||
import { ExtHostThreadService } from "vs/workbench/services/thread/node/extHostThreadService";
|
||||
import { realpath } from 'fs';
|
||||
import { TrieMap } from "vs/base/common/map";
|
||||
|
||||
class ExtensionMemento implements IExtensionMemento {
|
||||
|
||||
@@ -115,7 +117,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
private readonly _storagePath: ExtensionStoragePath;
|
||||
private readonly _proxy: MainThreadExtensionServiceShape;
|
||||
private _activator: ExtensionsActivator;
|
||||
|
||||
private _extensionPathIndex: TPromise<TrieMap<IExtensionDescription>>;
|
||||
/**
|
||||
* This class is constructed manually because it is a service, so it doesn't use any ctor injection
|
||||
*/
|
||||
@@ -202,6 +204,31 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
}
|
||||
}
|
||||
|
||||
// create trie to enable fast 'filename -> extension id' look up
|
||||
public getExtensionPathIndex(): TPromise<TrieMap<IExtensionDescription>> {
|
||||
if (!this._extensionPathIndex) {
|
||||
const trie = new TrieMap<IExtensionDescription>();
|
||||
const extensions = this.getAllExtensionDescriptions().map(ext => {
|
||||
if (!ext.main) {
|
||||
return undefined;
|
||||
}
|
||||
return new TPromise((resolve, reject) => {
|
||||
realpath(ext.extensionFolderPath, (err, path) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
trie.insert(path, ext);
|
||||
resolve(void 0);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
this._extensionPathIndex = TPromise.join(extensions).then(() => trie);
|
||||
}
|
||||
return this._extensionPathIndex;
|
||||
}
|
||||
|
||||
|
||||
public deactivate(extensionId: string): TPromise<void> {
|
||||
let result: TPromise<void> = TPromise.as(void 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user