-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
[feature] debugger REPL? #1141
Comments
thanks for the suggestion! debugger repl looks like a very interesting topic and I will investigate it later. At the moment, ast-grep's top priority is to ship |
Oooh! That's exciting! Is there an issue and/or branch I can follow with updates on |
Hi @vergenzt, the branch has not been created yet and the API is under design. I will create an issue to track the progress of it. |
How would you feel about me attempting this debugger feature on my own in parallel? I'm new to Rust so it would take me a while, but I'm curious whether you're open to reviewing progress / a design proposal. |
A few thoughts:
|
Hi! Thanks for your input! I'm more leaning toward to have a debugger on the web playground. https://ast-grep.github.io/playground.html Reasoning:
Pros for building debugger on playground
|
I didn't think it would be a proper gdb-level breakpoint, just a "breakpoint" as in a place where we tell the code to stop and await user input (i.e. it could just output a prompt token, wait for an input command, respond to that input command, and repeat). But I hear ya that a web debugger makes more sense - I hadn't thought of that since I haven't been able to use the web debugger much yet as I'm using a custom language. |
How do you think about making the playground load WASM file? |
That would be awesome! Great idea. |
⭐ Suggestion
It'd be really nice to be able to have some sort of interactive REPL where the program pauses on each node traversed and drops into a simple REPL console that lets you print out attributes of the current node and figure out why a rule is or isn't matching.
💻 Use Cases
--debug
flag tosg scan
orsg run
that drops me into a primitive REPL to inspect the current parsing state.[m]etavars
- print metavars that have matched so far[pn]/print-node
- print current node in AST form[pr]/print-rule
- print current (sub)rule attempting to be matched[s]ource
- print source code for current node's range[u]p
- go up in the rule matching frame (to show node / source for parent rule(s))[d]own
- go down in the rule matching frame (unless at bottom)[k]
- go up in the AST frame (while staying in the same rule matching frame; AST frame resets upon rule frame movement)[j]
- go down in the AST frame (while staying in the same rule matching frame)[n]ext
- continue with match to next sibling node[i]nto
- continue with match into first child node (or next sibling node if no children)[o]ut
- continue with match, skipping remaining sibling nodes[c]ontinue
- continue with match until next breakpoint or end[q]uit/exit
- exit the commandbreakpoint: true
to trigger spawning this REPL?The text was updated successfully, but these errors were encountered: