-
Notifications
You must be signed in to change notification settings - Fork 891
Description
How can a language server decline to answer a request for the time being (e.g. because it's not ready), but without popping up a message-box?
Currently we are responding with RequestCancelled because this is the only error-code that VSCode won't pop up a message-box for. But it's an abuse: this is not what the spec says this error-code is for.
For instance, autocomplete. If the user wants member-autocomplete x.|
, showing all the members available on x, then a language server can answer this pretty soon after initialization. But if the user wants global-autocomplete const x = new |
then the language server needs to index every top-level symbol that appears in the entire project before it can give a definitive answer. In a project of 500k files, this indexing can easily take 1min+. It would be wrong to deny member-autocomplete for that full 1min.
Therefore: the language server wants to receive all autocomplete requests from fairly soon on, but for some of them (based on its own internal processing) it wants to decline to answer. Moreover that "decline-to-answer" shouldn't pop up a message-box. It would be intolerable to have a message-box appear for every keystroke after const x = new |
.
The language server could respond with an empty autocomplete answer for when it's not ready. Or, in the case of global-autocomplete, it could respond with a partial answer that includes all the top-level symbols that it has found so far. But this is scary -- we have no idea whether VSCode will cache the empty answer, and we need a guarantee that it won't.