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

Flush errors after namer and resolver #7796

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft

Flush errors after namer and resolver #7796

wants to merge 14 commits into from

Conversation

ilyailya
Copy link
Collaborator

@ilyailya ilyailya commented Mar 30, 2024

The PR flushes errors after running the namer and the resolver.
The change also adds cache for the errors, preventing Sorbet from losing errors due to additional flushes

Motivation

This would make Sorbet feel more responsive, as errors would be displayed more quickly in LSP mode.

I tested the PR on Stripe's codebase by inserting a specific piece of code and tracking the timing of error reports through LSP logs

    include # this is a namer error

    B = T.type_alias { String }


    class A < B # this is resolver error
    end
Error flushing mode Time until Namer error, s Time until Resolver error, s
Only after typecheck 12.29 12.29
After namer, resolver and typechek 6.3 11.4

Test plan

See included automated tests.

ilyailya added 10 commits May 3, 2024 17:48
The method flushes errors, and also makes a copy of each error to store
it in the error cache in the GlobalState
The method fetches existing errors from the error cache and clears the
cache afterwards
The method fetches additional errors from the cache before flushing, but
doesn't add new errors into the cache
That might change in the future. For example, it would be useful to
leave errors after typecheck to reuse them for codeAction requests
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

Successfully merging this pull request may close these issues.

None yet

1 participant