-
Notifications
You must be signed in to change notification settings - Fork 5
Add LSIF support #85
Add LSIF support #85
Conversation
| } | ||
|
|
||
| const sendRequest: SendRequest = async ({ rootURI, requestType, request, useCache }) => { | ||
| const sendRequest: SendRequest<any> = async ({ rootURI, requestType, request, useCache }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The any here (and elsewhere in this file) doesn't make this less type safe than it was before.
| }) | ||
| ) | ||
| .subscribe() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registerWhile was simply moved. Ignore the diff here.
| definition: wrapMaybe(definition), | ||
| references: wrapMaybe(references), | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initLSP is just a refactored version of the old activateUsingWebSockets.
| definition: handler.definition.bind(handler), | ||
| references: handler.references.bind(handler), | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's inside initBasicCodeIntel already existed, I just made a new function out of it.
| null | ||
| ), | ||
| }) | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the core of this change. The idea is to try LSIF, then language server, then basic-code-intel in that order. If one of them succeeds, stop and use its result.
asyncFirst tries calling each function in the array in turn, stopping when it got a non-undefined result. null is the default value (in case none of the functions returned non-undefined, which is actually impossible because the basicCodeIntel functions always return a result).
|
Although the diff is large, most of it is code that just got moved around. Since the core change is small, the dependent PR got reviewed, and I manually tested a bunch of configurations, I feel confident merging this before getting review. Feel free to still review, we can improve things further later. |
Depends on sourcegraph/code-intel-extensions#124 v7.0.0
The main idea is to decide which way to provide code intel on each request in priority order: LSIF, language server, basic-code-intel.
Test plan: