Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

☂️ Symbol/Scope Resolution #2488

Closed
11 of 15 tasks
xunilrj opened this issue Apr 25, 2022 · 4 comments
Closed
11 of 15 tasks

☂️ Symbol/Scope Resolution #2488

xunilrj opened this issue Apr 25, 2022 · 4 comments
Assignees
Labels
A-Compiler Area: compiler A-Parser Area: parser L-JavaScript Langauge: JavaScript L-JSX Language: JSX L-TypeScript Area: TypeScript support in Rome umbrella Issue to track a collection of other issues
Milestone

Comments

@xunilrj
Copy link
Contributor

xunilrj commented Apr 25, 2022

This issue is tracking all the implementation to achieve two tasks:

1 - Allow "go to definition" on the editor;
2 - Allow to warn against "unused Variables" when linting;

See this discussion about the semantic model architecture: #2614
See this discussion about the architecture on how the semantic model is going to be used inside linters: #2603

Steps

This is my suggestion for implementing the two tasks above. It is actually a progressive implementation:

1 - We do not offer a semantic façade at all. "unusedVariables" lint would just consume the parsing tree, and iterate it to find unused variables;
2 - We cache this iteration somehow to make the lint have a decent performance;
3 - We build the "service/context" architecture that will be passed into the lint;
4 - We store the "service/context" inside NodeData;
5 - We create the untyped Semantic Tree;
6 - We change the "unusedVariable" lint rule to use the semantic tree.
7 - We implement the typed Semantic Tree. Probably just the first SemanticJsVariableDeclaration.
8 - We change the "unusedVariable" lint rule to query for the type semantic tree.

Tasks

  • Parse Microsoft/ts .symbols file (see feature(rome_js_parser): coverage test suite for ts symbols file #2588)
    • basic coverage test running
    • achieve +90% of passess
  • Generate Symbols Events
    • DeclarationFound
    • ReferenceFound
  • Implement simple Scope resolution
    • ScopeStarted
    • ScopeEnded
  • Support Hoisting
    • ReferenceSolved
  • LSP
    • F12 - go to definition
  • Lint
    • lint for "unused variable"
@xunilrj xunilrj added the umbrella Issue to track a collection of other issues label Apr 25, 2022
@xunilrj xunilrj self-assigned this Apr 25, 2022
@ematipico
Copy link
Contributor

Will this be part of the parsing phase or another another phase after the parsing phase?

@xunilrj xunilrj added L-JavaScript Langauge: JavaScript L-TypeScript Area: TypeScript support in Rome A-Parser Area: parser L-JSX Language: JSX labels Apr 25, 2022
@xunilrj
Copy link
Contributor Author

xunilrj commented Apr 25, 2022

Another pass.
The final architecture, we are still discussing (#2603)

So for these tasks, it will actually be another function that will be called manually when testing.

@xunilrj
Copy link
Contributor Author

xunilrj commented Oct 4, 2022

To reach 90% we need to deal with a lot of edge cases that are not relevant for the moment.

@xunilrj
Copy link
Contributor Author

xunilrj commented Oct 4, 2022

"Goto definition" will only be relevant when we run and the only LSP (non vscode).

@xunilrj xunilrj closed this as completed Oct 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Compiler Area: compiler A-Parser Area: parser L-JavaScript Langauge: JavaScript L-JSX Language: JSX L-TypeScript Area: TypeScript support in Rome umbrella Issue to track a collection of other issues
Projects
Status: Done
Development

No branches or pull requests

2 participants