Skip to content

Update extensionPaths when web extension host started #193849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Mar 15, 2024
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
42011d8
Invalidate and update extensionPaths on load
thegecko Sep 22, 2023
e60d73d
Merge branch 'main' into fix-web-extension-loading
thegecko Sep 26, 2023
52b1467
Merge branch 'main' into fix-web-extension-loading
thegecko Oct 5, 2023
834eacf
Merge branch 'main' into fix-web-extension-loading
thegecko Nov 4, 2023
a2abc5c
Merge branch 'main' into fix-web-extension-loading
thegecko Nov 4, 2023
9d2fbe6
Merge branch 'main' into fix-web-extension-loading
thegecko Nov 11, 2023
c7abcea
Merge branch 'main' into fix-web-extension-loading
thegecko Nov 14, 2023
9907bd5
Merge branch 'main' into fix-web-extension-loading
thegecko Nov 16, 2023
44b20d0
Merge branch 'main' into fix-web-extension-loading
thegecko Nov 22, 2023
aa52ec9
Merge branch 'main' into fix-web-extension-loading
thegecko Dec 1, 2023
5550423
Merge branch 'main' into fix-web-extension-loading
thegecko Dec 9, 2023
8967598
Merge branch 'main' into fix-web-extension-loading
thegecko Dec 12, 2023
dd41567
Merge branch 'main' into fix-web-extension-loading
thegecko Dec 14, 2023
f94c5cb
Merge branch 'main' into fix-web-extension-loading
thegecko Dec 17, 2023
a4ca883
Merge branch 'main' into fix-web-extension-loading
thegecko Dec 27, 2023
aee1b44
Merge branch 'main' into fix-web-extension-loading
thegecko Jan 2, 2024
270ed9a
Merge branch 'main' into fix-web-extension-loading
thegecko Jan 4, 2024
e2fb667
Merge branch 'main' into fix-web-extension-loading
thegecko Jan 22, 2024
95a59c1
Merge branch 'main' into fix-web-extension-loading
thegecko Jan 25, 2024
14c1573
Merge branch 'main' into fix-web-extension-loading
thegecko Feb 2, 2024
fec35de
Merge branch 'main' into fix-web-extension-loading
thegecko Feb 9, 2024
3182e6b
Merge branch 'main' into fix-web-extension-loading
thegecko Mar 2, 2024
0eba4cc
Merge branch 'main' into fix-web-extension-loading
alexdima Mar 15, 2024
59460db
Also update the `ExtensionPaths` search tree after startup because it…
alexdima Mar 15, 2024
d3008e7
Cache realpath calls
alexdima Mar 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/vs/workbench/api/common/extHostExtensionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
private readonly _storagePath: IExtensionStoragePaths;
private readonly _activator: ExtensionsActivator;
private _extensionPathIndex: Promise<ExtensionPaths> | null;
private _realPathCache = new Map<string, Promise<string>>();

private readonly _resolvers: { [authorityPrefix: string]: vscode.RemoteAuthorityResolver };

Expand Down Expand Up @@ -332,11 +333,16 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
}

/**
* Applies realpath to file-uris and returns all others uris unmodified
* Applies realpath to file-uris and returns all others uris unmodified.
* The real path is cached for the lifetime of the extension host.
*/
private async _realPathExtensionUri(uri: URI): Promise<URI> {
if (uri.scheme === Schemas.file && this._hostUtils.fsRealpath) {
const realpathValue = await this._hostUtils.fsRealpath(uri.fsPath);
const fsPath = uri.fsPath;
if (!this._realPathCache.has(fsPath)) {
this._realPathCache.set(fsPath, this._hostUtils.fsRealpath(fsPath));
}
const realpathValue = await this._realPathCache.get(fsPath)!;
return URI.file(realpathValue);
}
return uri;
Expand Down Expand Up @@ -986,10 +992,13 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
return result;
}

public $startExtensionHost(extensionsDelta: IExtensionDescriptionDelta): Promise<void> {
public async $startExtensionHost(extensionsDelta: IExtensionDescriptionDelta): Promise<void> {
extensionsDelta.toAdd.forEach((extension) => (<any>extension).extensionLocation = URI.revive(extension.extensionLocation));

const { globalRegistry, myExtensions } = applyExtensionsDelta(this._activationEventsReader, this._globalRegistry, this._myRegistry, extensionsDelta);
const newSearchTree = await this._createExtensionPathIndex(myExtensions);
const extensionsPaths = await this.getExtensionPathIndex();
extensionsPaths.setSearchTree(newSearchTree);
this._globalRegistry.set(globalRegistry.getAllExtensionDescriptions());
this._myRegistry.set(myExtensions);

Expand Down