Skip to content

Commit 1b6fabf

Browse files
authored
Merge pull request #163 from ono-max/patch-4
Revert "Merge pull request #162 from ono-max/patch-3"
2 parents b6a7d5e + a368584 commit 1b6fabf

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

extension/src/VisualizationBackend/RbVisualizationSupport.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { DataExtractionResult, DataExtractorId, DataResult } from "@hediet/debug-visualizer-data-extraction";
1+
import { DataExtractionResult, DataResult } from "@hediet/debug-visualizer-data-extraction";
22
import { hotClass, registerUpdateReconciler } from "@hediet/node-reload";
33
import { Config } from "../Config";
44
import { DebuggerViewProxy } from "../proxies/DebuggerViewProxy";
@@ -96,9 +96,10 @@ class RbVisualizationBackend extends VisualizationBackendBase {
9696
}
9797
};
9898
}
99-
100-
const wrappedExpr = await this._getExpression(preferredExtractorId || '', expression, frameId);
101-
99+
const preferredId = preferredExtractorId || '';
100+
const wrappedExpr = `
101+
DebugVisualizer.to_debug_visualizer_protocol_json("${preferredId}", ${expression})
102+
`;
102103
const reply = await this.debugSession.evaluate({
103104
expression: wrappedExpr,
104105
frameId,
@@ -138,21 +139,4 @@ class RbVisualizationBackend extends VisualizationBackendBase {
138139
};
139140
}
140141
}
141-
142-
private async _getExpression(preferredId: string | DataExtractorId, expression: string, frameId: number | undefined) {
143-
// From version 1.7, `::DEBUGGER__::NaiveString` class is introduced to get whole body of String.
144-
// https://github.com/ruby/debug/commit/2f510f0ed685da2f78b370fb8898ffbd2a4f1cf7
145-
const reply = await this.debugSession.evaluate({
146-
expression: "defined? ::DEBUGGER__::NaiveString",
147-
frameId,
148-
context: this.defaultContext
149-
});
150-
const wrappedExpr = `DebugVisualizer.to_debug_visualizer_protocol_json("${preferredId}", ${expression})`;
151-
// Because reply.result is '"constant"', we use includes method here.
152-
if (reply.result.includes('constant')) {
153-
return `::DEBUGGER__::NaiveString.new(${wrappedExpr})`;
154-
} else {
155-
return wrappedExpr;
156-
}
157-
}
158142
}

0 commit comments

Comments
 (0)