Skip to content

Add LSP CallHierarchy support#82865

Merged
JoeRobich merged 3 commits intomainfrom
dev/jorobich/lsp-callhierarchy
Mar 31, 2026
Merged

Add LSP CallHierarchy support#82865
JoeRobich merged 3 commits intomainfrom
dev/jorobich/lsp-callhierarchy

Conversation

@JoeRobich
Copy link
Copy Markdown
Member

@JoeRobich JoeRobich commented Mar 20, 2026

Builds on #82864

Resolves dotnet/vscode-csharp#6297
Resolves #83007

Screen.Recording.2026-03-18.at.9.25.35.PM.mov
Microsoft Reviewers: Open in CodeFlow

@JoeRobich JoeRobich requested a review from a team as a code owner March 20, 2026 03:45
{
var syntax = await syntaxReference.GetSyntaxAsync(cancellationToken).ConfigureAwait(false);
if (semanticModel.Language == LanguageNames.VisualBasic && syntax.Parent != null)
syntax = syntax.Parent;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

doc - didn't quite understand why this happens for VB?

Copy link
Copy Markdown
Member Author

@JoeRobich JoeRobich Mar 31, 2026

Choose a reason for hiding this comment

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

Added a comment. Getting a syntax node for a VB declaration returns the statement not a body. Need the body to get operations.

Similar to here and here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it isn't too complex, I'd prefer if this was something that could be done in the VB impl (with an abstract override) instead of the language check, but won't block on that

if (referencedSymbol == null || !SupportsCallHierarchy(referencedSymbol))
continue;

var referencedProject = project.Solution.GetProject(referencedSymbol.ContainingAssembly, cancellationToken) ?? project;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems a little weird to set the referenced project to the project here - wouldn't that create the wrong symbol key? If we can't find the project should we even create the item (not sure what scenarios will hit this)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I don't know why a project wouldn't be found for the symbol. Will have it just continue.

@JoeRobich JoeRobich force-pushed the dev/jorobich/lsp-callhierarchy branch 3 times, most recently from 2b7c3dc to 9e0850b Compare March 31, 2026 05:30
@JoeRobich JoeRobich force-pushed the dev/jorobich/lsp-callhierarchy branch from 9e0850b to 0225eec Compare March 31, 2026 18:16
{
var syntax = await syntaxReference.GetSyntaxAsync(cancellationToken).ConfigureAwait(false);
if (semanticModel.Language == LanguageNames.VisualBasic && syntax.Parent != null)
syntax = syntax.Parent;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it isn't too complex, I'd prefer if this was something that could be done in the VB impl (with an abstract override) instead of the language check, but won't block on that

@JoeRobich JoeRobich enabled auto-merge (squash) March 31, 2026 22:08
@JoeRobich JoeRobich merged commit 83c179c into main Mar 31, 2026
24 of 25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Mar 31, 2026
@qiulirui
Copy link
Copy Markdown

Thank you. You've made a great work !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable Call Hierarchy calls in Roslyn LSP Add Call Hierarchy

3 participants