feat: introduce platform defs for adding additional spotlight searchers (#3631)
This commit is contained in:
@@ -112,6 +112,7 @@ import {
|
|||||||
WorkspaceSpotlightSearcherService,
|
WorkspaceSpotlightSearcherService,
|
||||||
} from "~/services/spotlight/searchers/workspace.searcher"
|
} from "~/services/spotlight/searchers/workspace.searcher"
|
||||||
import { InterceptorSpotlightSearcherService } from "~/services/spotlight/searchers/interceptor.searcher"
|
import { InterceptorSpotlightSearcherService } from "~/services/spotlight/searchers/interceptor.searcher"
|
||||||
|
import { platform } from "~/platform"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
@@ -141,6 +142,10 @@ useService(WorkspaceSpotlightSearcherService)
|
|||||||
useService(SwitchWorkspaceSpotlightSearcherService)
|
useService(SwitchWorkspaceSpotlightSearcherService)
|
||||||
useService(InterceptorSpotlightSearcherService)
|
useService(InterceptorSpotlightSearcherService)
|
||||||
|
|
||||||
|
platform.spotlight?.additionalSearchers?.forEach((searcher) =>
|
||||||
|
useService(searcher)
|
||||||
|
)
|
||||||
|
|
||||||
const search = ref("")
|
const search = ref("")
|
||||||
|
|
||||||
const searchSession = ref<SpotlightSearchState>()
|
const searchSession = ref<SpotlightSearchState>()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { HoppModule } from "~/modules"
|
|||||||
import { InspectorsPlatformDef } from "./inspectors"
|
import { InspectorsPlatformDef } from "./inspectors"
|
||||||
import { Service } from "dioc"
|
import { Service } from "dioc"
|
||||||
import { IOPlatformDef } from "./io"
|
import { IOPlatformDef } from "./io"
|
||||||
|
import { SpotlightPlatformDef } from "./spotlight"
|
||||||
|
|
||||||
export type PlatformDef = {
|
export type PlatformDef = {
|
||||||
ui?: UIPlatformDef
|
ui?: UIPlatformDef
|
||||||
@@ -28,6 +29,7 @@ export type PlatformDef = {
|
|||||||
}
|
}
|
||||||
interceptors: InterceptorsPlatformDef
|
interceptors: InterceptorsPlatformDef
|
||||||
additionalInspectors?: InspectorsPlatformDef
|
additionalInspectors?: InspectorsPlatformDef
|
||||||
|
spotlight?: SpotlightPlatformDef
|
||||||
platformFeatureFlags: {
|
platformFeatureFlags: {
|
||||||
exportAsGIST: boolean
|
exportAsGIST: boolean
|
||||||
hasTelemetry: boolean
|
hasTelemetry: boolean
|
||||||
|
|||||||
10
packages/hoppscotch-common/src/platform/spotlight.ts
Normal file
10
packages/hoppscotch-common/src/platform/spotlight.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { Service } from "dioc"
|
||||||
|
import { SpotlightSearcher } from "~/services/spotlight"
|
||||||
|
|
||||||
|
export type SpotlightPlatformDef = {
|
||||||
|
additionalSearchers?: Array<
|
||||||
|
typeof Service<unknown> & { ID: string } & {
|
||||||
|
new (): Service & SpotlightSearcher
|
||||||
|
}
|
||||||
|
>
|
||||||
|
}
|
||||||
@@ -57,6 +57,7 @@ export type SpotlightSearcherResult = {
|
|||||||
* The keyboard shortcut to trigger the result
|
* The keyboard shortcut to trigger the result
|
||||||
*/
|
*/
|
||||||
keyboardShortcut?: string[]
|
keyboardShortcut?: string[]
|
||||||
|
additionalInfo?: unknown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user