Minor improvements.
This commit is contained in:
@@ -24,6 +24,7 @@ export interface DataExtractorApi {
|
||||
registerExtractor<TExtractedData extends ExtractedData>(
|
||||
extractor: DataExtractor<TExtractedData>
|
||||
): void;
|
||||
registerExtractors(extractors: DataExtractor<ExtractedData>[]): void;
|
||||
getData(
|
||||
value: unknown,
|
||||
evalFn: <T>(expression: string) => T,
|
||||
@@ -56,6 +57,11 @@ export function selfContainedInitDataExtractorApi(): boolean {
|
||||
registerExtractor(extractor) {
|
||||
obj[prefix + extractor.id] = extractor;
|
||||
},
|
||||
registerExtractors(extractors: DataExtractor<ExtractedData>[]) {
|
||||
for (const e of extractors) {
|
||||
this.registerExtractor(e);
|
||||
}
|
||||
},
|
||||
getData(value, evalFn, preferredDataExtractorId) {
|
||||
const extractions = new Array<DataExtraction<ExtractedData>>();
|
||||
const collector: ExtractionCollector<ExtractedData> = {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getDataExtractorApi } from "../DataExtractorApi";
|
||||
import { TypeScriptAstDataExtractor } from "./TypeScriptDataExtractors";
|
||||
import { AsIsDataExtractor } from "./AsIsDataExtractor";
|
||||
|
||||
export * from "./TypeScriptDataExtractors";
|
||||
export { AsIsDataExtractor, TypeScriptAstDataExtractor };
|
||||
|
||||
export function registerAll() {
|
||||
const api = getDataExtractorApi();
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
import * as ts from "typescript";
|
||||
import {
|
||||
enableHotReload,
|
||||
registerUpdateReconciler,
|
||||
getReloadCount,
|
||||
hotClass,
|
||||
} from "@hediet/node-reload";
|
||||
enableHotReload();
|
||||
|
||||
/*
|
||||
import {
|
||||
registerAll,
|
||||
CommonDataTypes,
|
||||
} from "@hediet/debug-visualizer-data-extraction";
|
||||
enableHotReload();
|
||||
import * as ts from "typescript";
|
||||
registerAll();
|
||||
*/
|
||||
|
||||
registerUpdateReconciler(module);
|
||||
|
||||
registerAll();
|
||||
|
||||
@hotClass(module)
|
||||
class Main {
|
||||
run() {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
Provides infrastructure to visualize values while debugging.
|
||||
|
||||
This extension is still in development. Some VS Code APIs are still missing for the best experience.
|
||||
This extension is still in development. Also, for the best user experience some VS Code APIs are missing.
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
],
|
||||
"preview": true,
|
||||
"activationEvents": [
|
||||
"*"
|
||||
"onCommand:vscode-debug-visualizer.new-visualizer",
|
||||
"onDebug",
|
||||
"onWebviewPanel:debugVisualizer"
|
||||
],
|
||||
"main": "./out/extension.js",
|
||||
"contributes": {
|
||||
|
||||
@@ -12,6 +12,8 @@ import {
|
||||
DataExtractorId,
|
||||
ApiHasNotBeenInitializedCode,
|
||||
selfContainedInitDataExtractorApi,
|
||||
TypeScriptAstDataExtractor,
|
||||
AsIsDataExtractor,
|
||||
} from "@hediet/debug-visualizer-data-extraction";
|
||||
import {
|
||||
DataExtractionState,
|
||||
@@ -144,7 +146,13 @@ class JsDebuggerSourceImplementation implements JsDataSource {
|
||||
session: vscode.DebugSession
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
const expression = `(${selfContainedInitDataExtractorApi.toString()})()`;
|
||||
let expression = `(${selfContainedInitDataExtractorApi.toString()})();`;
|
||||
|
||||
const es = [TypeScriptAstDataExtractor, AsIsDataExtractor].map(
|
||||
e => `new (${e.toString()})()`
|
||||
);
|
||||
expression += `(${selfContainedGetInitializedDataExtractorApi.toString()})()`;
|
||||
expression += `.registerExtractors([${es.join(",")}])`;
|
||||
|
||||
const reply = await session.customRequest("evaluate", {
|
||||
expression,
|
||||
|
||||
Reference in New Issue
Block a user