-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Support navigating to an interceptor location when on an intercepted method call. #74006
Conversation
…i/roslyn into gotoDefInterceptor
src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems
Show resolved
Hide resolved
@@ -620,9 +617,6 @@ public bool IsInConstructor(SyntaxNode node) | |||
public bool IsUnsafeContext(SyntaxNode node) | |||
=> node.IsUnsafeContext(); | |||
|
|||
public SyntaxNode GetNameOfAttribute(SyntaxNode node) | |||
=> ((AttributeSyntax)node).Name; |
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.
moved to common ISyntaxFacts pattern where there is GetPartsOfXXX
(GetPartsOfAttribute in this case), and the GetXxxOfYYY
is now an extension that defers to that.
@ToddGrun ptal. |
src/EditorFeatures/Core/Navigation/AbstractDefinitionLocationService.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex_Persistence.cs
Show resolved
Hide resolved
{ | ||
interceptsLocationInfo.Add( | ||
new InterceptsLocationData( | ||
ImmutableCollectionsMarshal.AsImmutableArray(reader.ReadByteArray()), |
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.
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.
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.
gotcha... i like this.
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.
ok. i do like this form and would prefer to keep it.
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.
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)) |
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.
Dumb question: Does the balanced/automatic mode affect whether this contentHash matches a source generator's value for it?
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.
let's talk offline. i want to make sure i understand your question.
...s/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SemanticFacts/CSharpSemanticFacts.cs
Show resolved
Hide resolved
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.
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: