Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

code intel: Fix empty popovers#41958

Merged
fkling merged 1 commit into
mainfrom
fkling/41931-empty-popovers
Sep 23, 2022
Merged

code intel: Fix empty popovers#41958
fkling merged 1 commit into
mainfrom
fkling/41931-empty-popovers

Conversation

@fkling

@fkling fkling commented Sep 22, 2022

Copy link
Copy Markdown
Contributor

Fixes #41931

It looks like defaulting to {contents: []} is wrong here. Comparing the data received from the getHovers when legacy extensions are enabled I can see that 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))
    )
)

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.

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.
@fkling fkling added team/graph Graph Team (previously Code Intel/Language Tools/Language Platform) integrations labels Sep 22, 2022
@cla-bot cla-bot Bot added the cla-signed label Sep 22, 2022

@philipp-spiess philipp-spiess left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@fkling fkling merged commit e2df224 into main Sep 23, 2022
@fkling fkling deleted the fkling/41931-empty-popovers branch September 23, 2022 08:45
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))
    )
)
```
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed integrations team/graph Graph Team (previously Code Intel/Language Tools/Language Platform)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extensions: empty popover for dockerfile

2 participants