-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Make Implement with Copilot light up on member name
#77769
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
Make Implement with Copilot light up on member name
#77769
Conversation
Implement with Copilot light up on method or property name with throw nodeImplement with Copilot light up on member name of throw node
Implement with Copilot light up on member name of throw nodeImplement with Copilot light up on member name
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
|
What are the downsides of reporting one diagnostic with the span of the entire method? |
I considered that too. just went with this flow instead. can't think of downsides, just that I'd have to make new changes :) I like that the code action is specifically on the throw. I just know that I got specific feedback that having it light up on method name makes sense. |
The downside (including being on the method signature) is that this now shows up for anywhere in teh method no matter what you are on (and even if you don't see the throw-new-... part. My recommendation woudl be that we only show this on the method itself if hte method is trivial. So it's a method that only contains the throw. Otherwise, we're making a strange connection here between a particular single expression in a method, with its header, which is not something we do elsewhere. |
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
| .RunAsync(); | ||
| } | ||
|
|
||
| private static ImmutableDictionary<SyntaxNode, ImplementationDetails> BuildResult(ImmutableDictionary<SyntaxNode, ImmutableArray<ReferencedSymbol>> memberReferences, Dictionary<string, string> implementationMap) |
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.
why is the impl map keyed on string?
also, how would the impl map work if you have multiple methods with the same name. something is weird here.
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.
it's just to mock copilot behavior for testing
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.
how would the impl map work if you have multiple methods with the same name
The method BuildResult here is mocking copilot behavior. In reality we match on other parts of the member such as params, return, etc. so that means we properly support overload use cases. The logic you see here is an oversimplification of what copilot service does and I am just mocking it here.
as far as roslyn is concerned, it gives and receives member nodes and therefore we are properly keying off of member, not any string whatsoever
...Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionDiagnosticAnalyzer.cs
Outdated
Show resolved
Hide resolved
…ntedExceptionDiagnosticAnalyzer.cs Co-authored-by: Cyrus Najmabadi <cyrus.najmabadi@gmail.com>
Every time a developer uses the 💡
Generate Methodfeature in VS, then with a ctrl+dot the cursor gets placed on the name of the newly generated method which by default containsthrow new NotImplementedException():Implement_with_Copilot_GH_Clip.mp4
To help the discoverability and usability of
Implement with Copilot, especially for the developers frequently using theGenerate Methodfeature, I am making the analyzer diagnostic forImplement with Copilotalso light up on the method or property name containing theNotImplementedExceptionthrow nodes.