diff --git a/packages/hoppscotch-common/src/components/app/spotlight/index.vue b/packages/hoppscotch-common/src/components/app/spotlight/index.vue index 103afedba..b8f9c8887 100644 --- a/packages/hoppscotch-common/src/components/app/spotlight/index.vue +++ b/packages/hoppscotch-common/src/components/app/spotlight/index.vue @@ -112,6 +112,7 @@ import { WorkspaceSpotlightSearcherService, } from "~/services/spotlight/searchers/workspace.searcher" import { InterceptorSpotlightSearcherService } from "~/services/spotlight/searchers/interceptor.searcher" +import { platform } from "~/platform" const t = useI18n() @@ -141,6 +142,10 @@ useService(WorkspaceSpotlightSearcherService) useService(SwitchWorkspaceSpotlightSearcherService) useService(InterceptorSpotlightSearcherService) +platform.spotlight?.additionalSearchers?.forEach((searcher) => + useService(searcher) +) + const search = ref("") const searchSession = ref() diff --git a/packages/hoppscotch-common/src/platform/index.ts b/packages/hoppscotch-common/src/platform/index.ts index 159402bc2..545987df4 100644 --- a/packages/hoppscotch-common/src/platform/index.ts +++ b/packages/hoppscotch-common/src/platform/index.ts @@ -11,6 +11,7 @@ import { HoppModule } from "~/modules" import { InspectorsPlatformDef } from "./inspectors" import { Service } from "dioc" import { IOPlatformDef } from "./io" +import { SpotlightPlatformDef } from "./spotlight" export type PlatformDef = { ui?: UIPlatformDef @@ -28,6 +29,7 @@ export type PlatformDef = { } interceptors: InterceptorsPlatformDef additionalInspectors?: InspectorsPlatformDef + spotlight?: SpotlightPlatformDef platformFeatureFlags: { exportAsGIST: boolean hasTelemetry: boolean diff --git a/packages/hoppscotch-common/src/platform/spotlight.ts b/packages/hoppscotch-common/src/platform/spotlight.ts new file mode 100644 index 000000000..b9dda97e0 --- /dev/null +++ b/packages/hoppscotch-common/src/platform/spotlight.ts @@ -0,0 +1,10 @@ +import { Service } from "dioc" +import { SpotlightSearcher } from "~/services/spotlight" + +export type SpotlightPlatformDef = { + additionalSearchers?: Array< + typeof Service & { ID: string } & { + new (): Service & SpotlightSearcher + } + > +} diff --git a/packages/hoppscotch-common/src/services/spotlight/index.ts b/packages/hoppscotch-common/src/services/spotlight/index.ts index 44d6f7242..2687b9aa8 100644 --- a/packages/hoppscotch-common/src/services/spotlight/index.ts +++ b/packages/hoppscotch-common/src/services/spotlight/index.ts @@ -57,6 +57,7 @@ export type SpotlightSearcherResult = { * The keyboard shortcut to trigger the result */ keyboardShortcut?: string[] + additionalInfo?: unknown } }