Skip to content

Expose a way to call into C#/VB quick info providers directly, bypassing the workspace.#53520

Merged
CyrusNajmabadi merged 7 commits intodotnet:mainfrom
CyrusNajmabadi:qi
May 21, 2021
Merged

Expose a way to call into C#/VB quick info providers directly, bypassing the workspace.#53520
CyrusNajmabadi merged 7 commits intodotnet:mainfrom
CyrusNajmabadi:qi

Conversation

@CyrusNajmabadi
Copy link
Contributor

@mavasani here's the approach i was thinking about.

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner May 19, 2021 19:08
@ghost ghost added the Area-IDE label May 19, 2021
Document document,
SyntaxToken token,
CancellationToken cancellationToken)
public async Task<QuickInfoItem?> GetQuickInfoAsync(CommonQuickInfoContext context)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

here is the new method you can call into directly to get QI from either the VB or C# semantic QI provider.

I don't have you going through teh service, because the service is the thing that implies you are tied to a workspace, and we ahve providers that deeply assume they are in a real workspace (for example, teh provider that gives diagnostic information in QI). It sounds like for lsif we dont' want that view, and we only want the view of what we can get purely with a semantic model. so that's what this API provides.

Copy link
Contributor

Choose a reason for hiding this comment

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

The core issue here is now all the code in QuickInfoServiceWithProviders.cs needs to be duplicated in LSIF generator or knowledge about two kinds of contexts needs to be added to QuickInfoServiceWithProviders to avoid code duplication. I don't like the former as it makes the code harder to maintain, and the latter is basically the same kind of refactoring that I have in my PR. Let me see if there is a good middle ground I can find to get your preferred API shape, while avoiding code duplication.

Copy link
Contributor

Choose a reason for hiding this comment

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

This API also needs to move further up the type hierarchy into CommonQuickInfoProvider, otherwise we miss getting quick info from other providers that derive from it: https://sourceroslyn.io/#Microsoft.CodeAnalysis.Features/QuickInfo/CommonQuickInfoProvider.cs,8b30b4e85a5560e4,references. This in turn means these other providers deriving from CommonQuickInfoProvider also need two implementations now - one which work on QuickInfoContext and other which work on CommonQuickInfoContext. It feels it will just get messier.

Copy link
Contributor

Choose a reason for hiding this comment

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

@CyrusNajmabadi I pushed 2 commits to your branch:

  1. First commit: Moves the semantic model based Get QI API to CommonQuickInfoProvider
  2. Second commit: Adds a semantic model based Get QI entry point to QuickInfoServiceWithProviders. This API can directly be invoked from LSIF generator now.

I personally prefer the 2 parallel set of types approach that I took in my PR (QuickInfoProvider/QuickInfoContext for external vs InternalQuickInfoProvider/InternalQuickInfoContext) over parallel APIs that need to be implemented all the way down the type chain, but I don't have strong feelings, so I am happy to sign off on this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This API also needs to move further up the type hierarchy into CommonQuick

This was intentional. I didn't think tjeh other providers make sense. I didn't think we wanted diagnostic information here. I also dont' think we can even support diagnostic information given that this runs on a workspace that will not have a real diagnostic service.

Also, the syntactic quick info didn't seem like something we wqanted. However, if we did, i would pull a common base type up above the Syntactic/Semantic providers.

Copy link
Contributor

@mavasani mavasani May 21, 2021

Choose a reason for hiding this comment

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

Oh okay - in that case feel free to revert my commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, actually, the way you did this is fine. You just didn't support this functionality with the diag provider. I think that's 100% ok. I thought you wanted it at the root and wanted to support diags :) I'm ok keeping your code. I just need to see why integration tests are failing.

{
internal readonly struct CommonQuickInfoContext
{
public readonly Workspace Workspace;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: this is just used to retrieve language services. it coudl be weakened to that type if desired.

@CyrusNajmabadi CyrusNajmabadi enabled auto-merge May 21, 2021 21:04
@CyrusNajmabadi CyrusNajmabadi merged commit 0c82b90 into dotnet:main May 21, 2021
@ghost ghost added this to the Next milestone May 21, 2021
@CyrusNajmabadi CyrusNajmabadi deleted the qi branch May 22, 2021 02:38
mavasani added a commit to mavasani/roslyn that referenced this pull request Jun 21, 2021
This change builds on top of dotnet#53520, which refactored the quick info service to work at the compiler layer.
This PR adds support to the LSIF generator to invoke into quick info service to compute the hover information and adds the hover result to the LSIF graph.
@RikkiGibson RikkiGibson modified the milestones: Next, 17.0.P2 Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants