Some improvements around error tolerance #320
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Because neither Ruby LSP's
Show syntax tree
command nor websites like Ruby Playground displays Prism's error messages, I added a new task to display a file's parse tree and Prism errors. This will make it easier to work with syntax-incorrect Ruby files.Keep Prism error id's type for easy comparison
We currently don't use the converted value and keeping the
pm_diagnostic_id_t
type makes it easy to compare the value withPM_ERR_*
constants directly.Stop surfacing Prism's EOF error
It usually appears when there's an unclosed statements/assignments, where the root error will also be surfaced. So it's not exactly important to surface this error.
But more importantly, because Prism puts this error at the very last line of the file when there's a missing
end
, it can't be represented in Sorbet's error comments.Test plan
See included automated tests.