sorbet / sorbet

A fast, powerful type checker designed for Ruby
https://sorbet.org
Apache License 2.0
3.62k stars 527 forks source link

LSP: Report fine-grained typechecking progress #1537

Open jvilk-stripe opened 5 years ago

jvilk-stripe commented 5 years ago

Problem

When Sorbet is thinking very hard, it currently sends two nonstandard LSP messages to clients that understand them:

These messages are not granular enough to give the user any indication of how long they need to wait. Also, if the user ends up seeing two "foo" operations back-to-back, it appears as one long "foo" operation.

Proposed solution

Migrate to using the proposed standard "progress" LSP messages, which are described in this GitHub issue:

https://github.com/microsoft/language-server-protocol/issues/70

It looks like VS Code may already support the proposed standard.

We could probably implement this behavior by hooking into the existing ProgressIndicator.

jvilk-stripe commented 4 years ago

Progress is now part of the spec:

https://microsoft.github.io/language-server-protocol/specifications/specification-current/#progress

lpan commented 4 years ago

Hi John, is this issue prioritized? If not, I would be interested in giving it a shot this weekend. Thanks!

jvilk-stripe commented 4 years ago

Hey there @lpan. This work is not currently prioritized; I'm working on performance which should reduce the need for fine-grained progress information. Note that the following PR, which is currently under review, may have an impact on the implementation of this feature:

https://github.com/sorbet/sorbet/pull/2549

We should still investigate switching from our custom "show operation" messages to progress messages, since the percentage field is optional.

Let me know if you make any... progress... on an implementation! :)