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

Add an easy way to get the code represented by expressionId for debugging. #12042

Open
farmaazon opened this issue Jan 10, 2025 · 0 comments
Open

Comments

@farmaazon
Copy link
Contributor

farmaazon commented Jan 10, 2025

Currently, when we have some expressionId in logs, sometimes we have no means to deduce which AST node is represented by it;

  1. Most expression ids are not stored in file, by design - only those having metadata attached. Other ids are re-generated on every run
  2. Even if we reproduce some issue and have application running, reading which part of code is represented by given expression Id is very hard.

Ad 2: a method accessible in web console should be enough. Current workaround is to attach a breakpoint in place like in the screenshot, then move some node (to trigger the breakpoint), and add a watch expression sourceRangeFromKey([...spanMapToIdMap(printWithSpans(module.root()).info).rangeToExpr.entries()].find(([, id]) => id === "<THE ID>")[0]) with substituted accordingly.

Ad 1: as the ids are stored in logs, the logs should also memorize what code snippet is represented by them, or replace those ids with line and character range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

1 participant