chore: small refactor to move the handlers out into an extension point
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -80,22 +80,32 @@ export const scaffolderTemplatingExtensionPoint =
|
||||
id: 'scaffolder.templating',
|
||||
});
|
||||
|
||||
/**
|
||||
* Autocomplete handler for the scaffolder.
|
||||
* @alpha
|
||||
*/
|
||||
export type AutocompleteHandler = ({
|
||||
resource,
|
||||
token,
|
||||
context,
|
||||
}: {
|
||||
resource: string;
|
||||
token: string;
|
||||
context: Record<string, string>;
|
||||
}) => Promise<{ results: { title: string }[] }>;
|
||||
|
||||
/**
|
||||
* Extension point for adding autocomplete handler providers
|
||||
* @alpha
|
||||
*/
|
||||
export interface ScaffolderAutocompleteExtensionPoint {
|
||||
addAutocompleteProvider(
|
||||
provider: ({
|
||||
type,
|
||||
token,
|
||||
query,
|
||||
}: {
|
||||
type: string;
|
||||
token: string;
|
||||
query: Record<string, string>;
|
||||
}) => Promise<{ results: { title: string }[] }>,
|
||||
): void;
|
||||
addAutocompleteProvider({
|
||||
id,
|
||||
handler,
|
||||
}: {
|
||||
id: string;
|
||||
handler: AutocompleteHandler;
|
||||
}): void;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user