-
Notifications
You must be signed in to change notification settings - Fork 237
Allow cohosting quick info to show html tag information even when on a taghelper or component tag. #12415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow cohosting quick info to show html tag information even when on a taghelper or component tag. #12415
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,7 +111,8 @@ protected override IRemoteHoverService CreateService(in ServiceArgs args) | |
| } | ||
| } | ||
|
|
||
| return Results(csharpHover); | ||
| // As there is a C# hover, stop further handling. | ||
| return new RemoteResponse<Hover?>(StopHandling: true, Result: csharpHover); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might be missing it, but I was expecting StopHandling to be used when we product a Razor response at times too. eg, when hovering over That check could even be done in the endpoint, by checking the file type in the endpoint (there is a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm probably missing something, but I see the if condition on line 65 hit when hovering over PageTitle, due to the remapping code in GetPositionInfo. Or is there another case you are concerned about that isn't true for line 65?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ohh of course, because thats actually a C# hover. Okay, cool. You lost the fight over who missed something :P |
||
| } | ||
|
|
||
| if (positionInfo.LanguageKind is not (RazorLanguageKind.Html or RazorLanguageKind.Razor)) | ||
|
|
@@ -152,7 +153,7 @@ protected override IRemoteHoverService CreateService(in ServiceArgs args) | |
| /// <remarks> | ||
| /// Once Razor moves wholly over to Roslyn.LanguageServer.Protocol, this method can be removed. | ||
| /// </remarks> | ||
| private Hover ConvertHover(Hover hover) | ||
| private static Hover ConvertHover(Hover hover) | ||
| { | ||
| // Note: Razor only ever produces a Hover with MarkupContent or a VSInternalHover with RawContents. | ||
| // Both variants return a Range. | ||
|
|
||
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.
I'd love some guidance on changing this to not make the html call if we aren't in an html context. It looks like this information isn't at my fingertips, and I noticed some other cohosting calls across to the remote service end up returning a flag indicating the language that is being operated in. Is that the general mechanism suggested to filter work done at this level by language?
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, the endpoints run in devenv, and we have no knowledge of the Razor syntax tree or anything that lets us determine what language is at a position there, so we have to jump to OOP to get that info. In this case, I would imagine the OOP call above would change to return a custom type that carries the hover info, and whether or not to call Html and merge the results.
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.
That's what I thought when I asked for guidance. I think the small change I made in commit 2 to the stopHandling determination in the remote process prevents most of the unnecessary html lsp requests.