Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thanks, 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.


Data 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!


Can you point us to where the existing extractors are implemented in the codebase?


In 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/c420f... [2] https://github.com/hediet/vscode-debug-visualizer/blob/maste...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: