Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty print values #1

Open
fitzgen opened this issue Feb 18, 2015 · 4 comments
Open

Pretty print values #1

fitzgen opened this issue Feb 18, 2015 · 4 comments

Comments

@fitzgen
Copy link
Contributor

fitzgen commented Feb 18, 2015

Source maps should be able to encode a pretty printer that takes the generated JS implementation of a value and displays it as it would look in the original source language.

@fitzgen
Copy link
Contributor Author

fitzgen commented Feb 18, 2015

For example, when using ClojureScript, it would sure be nice if the debugger didn't have to display generated JS implementation of a hash map, and could instead display the ClojureScript literal {"foo" 1, "bar" 2}.

screen shot 2015-02-18 at 3 02 33 pm

(Note: mori is ClojureScript's data structure library)

@andysterland
Copy link

.Awesome :).

Couple of questions:

  1. Is the scope of pretty printing limited to things that fit within existing visualizations? In your example above it's about providing a custom object view but it could do something crazy like render custom HTML to produce a table (of the map) etc.
  2. Any early thoughts on this this being on object vs. a type visualization? In IE's tools (F12) we do some type based visualizations. For example if you inspect a HTML element in the console F12 shows the HTML tree view rather than the regular object view.
    F12 inspecting a HTML and JS object
    In the example above I was wondering if the implication is that an object (in this case m) has all the information needed to visualize itself. Or, if it's the case that the object has some information that the tools can use to load/find/wish for an appropriate visualizer.
    Perhaps that's skipping to implementation, well it is really. But, I'm excited :).

@fitzgen
Copy link
Contributor Author

fitzgen commented Feb 19, 2015

I'd like to advocate the same general approach as #2 (comment):

  1. Envision the end goal; the ideal state we want to get to.
  2. Identify small, incremental steps we can take to move towards that ideal state in a future extensible way.

While I haven't thought as deeply about pretty printing as I have about encoding the environment/variables/scopes, I think we'd like to support:

  • source-level object representations (rather than generated JS implementation)
  • different visualization modes for the same type (eg, object view w/ properties vs. HTML markup view vs collapsed/summary vs expanded/detailed)
  • ability to use source-level type information
  • etc.

I think the incremental path to get there could be implementing that first bullet point, with the others as follow ups.

@littledan
Copy link
Member

This issue's importance was raised at the Igalia Web Engines Hackfest.

nicolo-ribaudo pushed a commit to nicolo-ribaudo/source-map that referenced this issue Mar 13, 2024
Convert the source map spec to bikeshed with minor edits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants