Skip to content
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

Support navigating to an interceptor location when on an intercepted method call. #74006

Merged
merged 38 commits into from
Jun 25, 2024

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Jun 14, 2024

In this case goto def will offer both the original definition requested, as well as the interceptor, allowing hte user to navigate to either.

Looks like:

image

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Jun 14, 2024
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review June 14, 2024 17:40
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner June 14, 2024 17:40
@@ -620,9 +617,6 @@ public bool IsInConstructor(SyntaxNode node)
public bool IsUnsafeContext(SyntaxNode node)
=> node.IsUnsafeContext();

public SyntaxNode GetNameOfAttribute(SyntaxNode node)
=> ((AttributeSyntax)node).Name;
Copy link
Member Author

Choose a reason for hiding this comment

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

moved to common ISyntaxFacts pattern where there is GetPartsOfXXX (GetPartsOfAttribute in this case), and the GetXxxOfYYY is now an extension that defers to that.

@CyrusNajmabadi CyrusNajmabadi requested a review from ToddGrun June 14, 2024 18:07
@CyrusNajmabadi
Copy link
Member Author

@ToddGrun ptal.

{
interceptsLocationInfo.Add(
new InterceptsLocationData(
ImmutableCollectionsMarshal.AsImmutableArray(reader.ReadByteArray()),
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably just me, but I'd find this easier to understand if the Read* calls were done in separate stmts on their own line, just to indicate that there is an exact mapping between the read/write behaviors.

Copy link
Member Author

Choose a reason for hiding this comment

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

gotcha... i like this.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok. i do like this form and would prefer to keep it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Think we're going to have to agree to disagree on this one. Not that big of a deal though.

// hand (as they involve embedded an encoded version of a file's content hash, position, and other debugging
// information). So the only realistic way to create them is by asking the compiler to create the attribute
// using SemanticModel.GetInterceptableLocation as part of a generator.
foreach (var generatedDocument in await document.Project.GetSourceGeneratedDocumentsAsync(cancellationToken).ConfigureAwait(false))
Copy link
Contributor

Choose a reason for hiding this comment

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

Dumb question: Does the balanced/automatic mode affect whether this contentHash matches a source generator's value for it?

Copy link
Member Author

Choose a reason for hiding this comment

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

let's talk offline. i want to make sure i understand your question.

@CyrusNajmabadi CyrusNajmabadi requested a review from ToddGrun June 24, 2024 19:59
Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

@CyrusNajmabadi CyrusNajmabadi enabled auto-merge June 24, 2024 21:26
@CyrusNajmabadi CyrusNajmabadi merged commit 778d674 into dotnet:main Jun 25, 2024
25 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Jun 25, 2024
@CyrusNajmabadi CyrusNajmabadi deleted the gotoDefInterceptor branch June 26, 2024 04:18
@RikkiGibson RikkiGibson modified the milestones: Next, 17.12 P1 Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants