Implements GenericDataExtractionProviderFactory. With this, the debug visualizer can be used with every language that can be debugged in VS Code.

This commit is contained in:
Henning Dieterichs
2020-02-18 03:04:59 +01:00
parent 5a4678b876
commit 5bc4347f3c
15 changed files with 466 additions and 253 deletions

View File

@@ -4,7 +4,9 @@ export type DataExtractionResult = {
availableExtractors: DataExtractorInfo[];
};
// Instances must be valid json values.
/**
* Instances must be valid json values.
*/
export type ExtractedData = {
kind: Record<string, true>;
};
@@ -18,3 +20,16 @@ export type DataExtractorInfo = {
export type DataExtractorId = {
__brand: "DataExtractorId";
} & string;
export function isExtractedData(val: unknown): val is ExtractedData {
if (typeof val !== "object" || !val || !("kind" in val)) {
return false;
}
const obj = val as any;
if (typeof obj.kind !== "object" || !obj.kind) {
return false;
}
return Object.values(obj.kind).every(val => val === true);
}