-
Notifications
You must be signed in to change notification settings - Fork 183
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 parse_lex
instead of parse
for Ruby and ERB documents
#3252
base: main
Are you sure you want to change the base?
Use parse_lex
instead of parse
for Ruby and ERB documents
#3252
Conversation
How to use the Graphite Merge QueueAdd the label graphite-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
39f084f
to
0611106
Compare
### Motivation The changes in Shopify/ruby-lsp#3252 will be breaking because the return of `document.parse_result` will change. However, that doesn't impact Tapioca and we will not include any breaking changes that do impact Tapioca in v0.24. Let's bump our upper requirement ahead of time, so that people can already start upgrading and so we can eliminate any windows where the Tapioca add-on wouldn't work. ### Implementation Just bumped the upper bound to < 0.25.
0611106
to
8b6dce7
Compare
8b6dce7
to
21a1986
Compare
Motivation
This is part of #1849, which is moving forward now with the immense help of @koic.
This PR switches the LSP from using
parse
to usingparse_lex
for Ruby and ERB documents. The difference is thatparse
only returns the AST nodes, whereasparse_lex
returns both the AST + tokenization information. That information is required for RuboCop to use the Prism AST.Implementation
The LSP itself doesn't need the lex part of the information. We will only need it for RuboCop related things.
So I created an
ast
method to return the same thing asparse
does and fixed all of the call sites.Note
Parse lex is actually quite a bit slower than regular parse. However, the performance gains we will get from avoiding the double-parse for every diagnostic computation will more than compensate for this price.
We'll monitor our performance telemetry to see if there's any meaningful degradation, but I don't expect that to be the case.
Automated Tests
Updated accordingly.