feat(lsp): improve registry completion suggestions #13023
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.
Resolves #10051
Still need to do all the tests, but it works. If folks want to take if for a road test, you can enable a prototype registry server by setting the following in your editor configuration:
The server "proxies" the information from
deno.land/x/
. Things registry servers can now implement with v2 are:Ability to return partial result sets. This is done in a backwards compatible fashion, where a server can either return a
string[]
or an JSON object like:Where if
isIncomplete
istrue
, it indicates that not all the results have been returned and subsequent queries to the"url"
field can be sent by the client to narrow down the result set.Ability to preselect particular selections, by setting the
"preselect"
value in the variable list response. This allow a registry, for example, to tell the client to choosemod.ts
as the default selection when completing an import (or whatever the server determines is the appropriate preselection.Ability to provide additional documentation for a suggestion/completion item by providing a
"documentation"
endpoint as part of thedeno-import-intellisense.json
. When the client displays a particular item, it will request the server to resolve the completion item, and if the"documentation"
endpoint is set, a request will be made to that completion endpoint. The endpoint should response with a documentation object:Technically, all these changes are non-breaking with v1, and the language server will simply adjust based on the runtime behaviour of the registry. The only real change is that v2 will cause the language server to validate the
deno-import-intellisense.json
in against the v2 specification.