5 ms·
In ruby if you have the right json schema set up it works. I'm not sure I completely grok yet how the data extractors would work on the ruby side yet though. h
by daviding 6y ago
In ruby if you have the right json schema set up it works. I'm not sure I completely grok yet how the data extractors would work on the ruby side yet though.
https://i.imgur.com/84mgPdF.jpg https://i.imgur.com/84mgPdF.jpg
- Gehinnn 6y agoData Extractors usually need support from the extension. But you can configure how to construct the expression that is sent to the debugger to be evaluated. By default, it is `x => x`, but you could do `x => extract_json(x)`.
- daviding 6y agoThanks, that works. I can put something simple in my settings.json like this "debugVisualizer.debugAdapterConfigurations": { "Ruby": { "expressionTemplate": "DataExtractor.to_table(${expr})", } }, ..and something simple in the debugee like this.. table_example = {"id"=> "1", "label"=> "One"}, {"id"=> "2", "label"=> "Two"}, {"id"=> "3", "label"=> "Three"} # Quick hash to visual table helper class DataExtractor def self.to_table(hash) meta_hash = { "kind" => {"table"=> true}, "rows"=> hash } meta_hash.to_json end end ..and we get a decent hash or ActiveRecord visualizer. Thanks for the hint.
- Gehinnn 6y agoData Extractors would also allow to offer alternative extraction options (like how visualization data should be constructed from the given value). The user can then select an alternative data extractor. The `expressionTemplate` does not allow to do that yet. If somebody is interested in implementing data extractors for Ruby, I can offer help!
- jonnytran 6y agoCan you point us to where the existing extractors are implemented in the codebase?
- Gehinnn 6y agoIn case of javascript, the data extractor runtime is injected into the debuggee at [1]. You can find the data extractor runtime implementation at [2]. [1] https://github.com/hediet/vscode-debug-visualizer/blob/c420ff7f6f42a55ee3692016df3ffd7a5d29402b/extension/src/EvaluationWatchService/EvaluationEngine/JsEvaluationEngine.ts#L126 https://github.com/hediet/vscode-debug-visualizer/blob/c420f... [2] https://github.com/hediet/vscode-debug-visualizer/blob/master/data-extraction/src/js/api/DataExtractorApiImpl.ts https://github.com/hediet/vscode-debug-visualizer/blob/maste...
- deleted 6y ago[deleted]