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

Use the compiler to drive as many language services as possible #11

Open
josephjclark opened this issue Jan 6, 2025 · 0 comments
Open

Comments

@josephjclark
Copy link
Collaborator

josephjclark commented Jan 6, 2025

For example, can we use the compiler to detect State and lazy state references and top level operations

This requires a big compiler change

  • instead of detecting and transforming structures, we split the compiler into two phases
  • Phase 1 traverses the AST, detects key structures (operation, lazy state reference) and annotates the AST
  • Phase 2 finds the annotated nodes and transforms them, just as it does today.

If we have this compiler architecture, then VSC only needs to run phase 1, not phase 2, and we can re-use the logic.

Can we swap out VSC's in built compiler and use our own? Rather than parsing twice? The dream implementation is that we would control the first ast compilation that VSC does, annotate extra stuff, and then pass the esprima API syntax tree down to VSC.

Alternatively, we extract the esprima tree from VSC and pass that into the compiler (rather than compiling ourselves with acorn).

Either of these solutions prevents a duplication of work. But it's not essential!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant