Files
languageservices/actions-languageservice/src/context-providers/descriptions.ts
T

15 lines
570 B
TypeScript
Raw Normal View History

2023-01-26 16:02:15 -08:00
import descriptions from "./descriptions.json" assert { type: 'json' };
2023-01-10 17:44:48 -08:00
2023-01-11 13:53:20 -08:00
export const RootContext = "root";
2023-01-10 17:44:48 -08:00
/**
* Get a description for a built-in context
* @param context Name of the context, for example `github`
* @param key Key of the context, for example `actor`
* @returns Description if one is found, otherwise undefined
*/
export function getDescription(context: string, key: string): string | undefined {
// The inferred type doesn't quite match the actual type, use any to work around that
return (descriptions as any)[context]?.[key]?.description;
}