This repository was archived by the owner on Sep 30, 2024. It is now read-only.
code intel: Fix empty popovers#41958
Merged
Merged
Conversation
It looks like defaulting to `{contents: []}` is wrong here. Comparing
the data received from the `getHovers` in the legacy and the migrated
extensions I can see that with legacy, the last value received is
```
{isLoading: false, result: null}
```
whereas with the migrated extensions its
```
{isLoading: false, result: {contents: []}}
```
If my investigation is correct then the legacy extension then the
equivalent code path in the legacy extensions does not fall back to a
default value. From https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph@3fc4cf0b5429353b06fba32a65e5b02f61fb8f9f/-/blob/client/shared/src/codeintel/api.ts?L97 :
```
return proxySubscribable(
callProviders(
state.hoverProviders,
providers => providersForDocument(document, providers, ({ selector }) => selector),
({ provider }) => provider.provideHover(document, position),
results => fromHoverMerged(mergeProviderResults(results))
)
)
```
With the change in this commit the empty popup does not appear. Having
said that, since I'm not that familiar with this part of the code base,
I definitely need someone to confirm that this is the right way to fix
this.
philipp-spiess
approved these changes
Sep 23, 2022
philipp-spiess
left a comment
Contributor
There was a problem hiding this comment.
Thanks you so much for looking into it. I agree that this is the right fix and also did some manual testing to confirm it works
11 tasks
camdencheek
pushed a commit
that referenced
this pull request
Sep 26, 2022
It looks like defaulting to `{contents: []}` is wrong here. Comparing
the data received from the `getHovers` in the legacy and the migrated
extensions I can see that with legacy, the last value received is
```
{isLoading: false, result: null}
```
whereas with the migrated extensions its
```
{isLoading: false, result: {contents: []}}
```
If my investigation is correct then the equivalent code path in the legacy extensions
does not fall back to a default value. From https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph@3fc4cf0b5429353b06fba32a65e5b02f61fb8f9f/-/blob/client/shared/src/codeintel/api.ts?L97 :
```
return proxySubscribable(
callProviders(
state.hoverProviders,
providers => providersForDocument(document, providers, ({ selector }) => selector),
({ provider }) => provider.provideHover(document, position),
results => fromHoverMerged(mergeProviderResults(results))
)
)
```
sashaostrikov
pushed a commit
that referenced
this pull request
Sep 29, 2022
It looks like defaulting to `{contents: []}` is wrong here. Comparing
the data received from the `getHovers` in the legacy and the migrated
extensions I can see that with legacy, the last value received is
```
{isLoading: false, result: null}
```
whereas with the migrated extensions its
```
{isLoading: false, result: {contents: []}}
```
If my investigation is correct then the equivalent code path in the legacy extensions
does not fall back to a default value. From https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph@3fc4cf0b5429353b06fba32a65e5b02f61fb8f9f/-/blob/client/shared/src/codeintel/api.ts?L97 :
```
return proxySubscribable(
callProviders(
state.hoverProviders,
providers => providersForDocument(document, providers, ({ selector }) => selector),
({ provider }) => provider.provideHover(document, position),
results => fromHoverMerged(mergeProviderResults(results))
)
)
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #41931
It looks like defaulting to
{contents: []}is wrong here. Comparing the data received from thegetHoverswhen legacy extensions are enabled I can see that the last value received iswhereas with the migrated extensions its
If my investigation is correct then the equivalent code path in the legacy extensions does not fall back to a default value. From https://sourcegraph.sourcegraph.com/github.com/sourcegraph/sourcegraph@3fc4cf0b5429353b06fba32a65e5b02f61fb8f9f/-/blob/client/shared/src/codeintel/api.ts?L97 :
With the change in this commit the empty popup does not appear. Having said that, since I'm not that familiar with this part of the code base, I definitely need someone to confirm that this is the right way to fix this.
Test plan
Manual testing.
App preview:
Check out the client app preview documentation to learn more.