Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
Create unique ID for each provider
Browse files Browse the repository at this point in the history
We must give each provider a unique ID, otherwise results get mixed up.
We derive the ID from the UUID of this extension and the product key of
the product.
  • Loading branch information
swsnr committed May 19, 2020
1 parent dd70886 commit 464c368
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,16 @@ const resultMetaForProject = (idea: Gio.DesktopAppInfo) => (
* projects, since JetBrains products dont provide an interface start a recent
* projects search within the app.
*
* @param projects The project to search in
* @param app The application info for the product the projects belong to
* @param product The product to create a search provider for.
* @param app The application info for the product.
* @param projects The recent projects of the product.
*/
const createProvider = (
projects: ProjectMap,
app: Gio.DesktopAppInfo
product: ProductInfo,
app: Gio.DesktopAppInfo,
projects: ProjectMap
): SearchProvider => ({
id: Self.uuid,
id: `${Self.uuid}-${product.key}`,
isRemoteProvider: false,
canLaunchSearch: true,
appInfo: app,
Expand Down Expand Up @@ -461,7 +463,7 @@ function init(): ExtensionState {
);
return;
}
providers.push(createProvider(projects, app));
providers.push(createProvider(product, app, projects));
});

providers.forEach((provider) => {
Expand Down

0 comments on commit 464c368

Please sign in to comment.