-
Notifications
You must be signed in to change notification settings - Fork 657
☂️ Weekly goals - week 41 #1700
Comments
I want to share an update on my current around formatting source files containing parsing errors (see draft PR #1707) The main change of the PR is to change This API change is working pretty nicely, and the PR shows that the formatter can format source files containing parsing errors where nodes or tokens are missing. However, the rslint-CST doesn't work well if there are additional For example the following script:
with the corresponding CST:
The main issue is that field accessors on the The same problem exists if the parser inserts an
which rslint parses to
rslint inserts the additional The only way to work around this without changing the CST structure is to directly work on the node's children but that comes with the downside that the resulting code will be very hard to maintain. That's why I suggest changing the parser to match Roslyn's behaviour:
I haven't thought about what that means for our However, enforcing a specific structure for every node combined with explicitly modelling trivia would allow us to use static-offsets in our field accessors, e.g. the Error recoveryI'm still undecided how the error recovery should work. The current implementation skips statements containing syntax errors but then continues with the next statement. I don't even know if this is too conservative or too lax? The main issue I see of doing supposedly clever error-recovering in the formatter is that the parser already performed some error-recovery, thus, what the formatter sees may already be different than what's written in the source file. I currently favour trusting whatever the parser came up with as being correct and improve in the parser's error recovery if this isn't good enough rather than trying to infer something from the CST structure. Further Improvements@ematipico and I discovered two additional properties of our AST that make it inconvenient to work with:
|
The team is going to have a series of meetings to discuss a series of arguments regarding the architecture of the compiler, parser and other stuff. This means that the next weekly goal will be delayed based on the outcome of these meetings. |
High Level Objectives / Questions we're trying to answer
rslint_parser
and see what we would be able to achieve;rslint_parser
would fit Rome's architecture;Projects / Tasks
rslint_parser
determines when a JavaScript code is broken and how its green trees are structured. The idea is that nodes that containsEROOR@
nodes should not be formatted and left as is. We will explore some heuristic to see if we're able to do that;rowan
fromrslint_parser
;rust-analyzer
issuesalsa
and it's current state;rustc
caching model;Risks
rslint_parser
might not fit our needs as it is now, and we would need to consider forking it or some parts of it;salsa
or other existing tools might not fit, and we would need to write a in-house caching systemThe text was updated successfully, but these errors were encountered: