- Notifications
You must be signed in to change notification settings - Fork4.2k
Add code refactoring to offer usings for fully qualified names#81484
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
…efactoringProviderCo-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
| { | ||
| Task M() => null; | ||
| } | ||
| """); |
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.
@copilot we should add two code actions. One that just does what you've done here (adds using and simplifies the name invoked on), but a second that does an 'add using and simplify all type names' which then looks for the namespace we're adding a using for and adds the simplification annotation. So if we addusing System; it will then fix up all System.Console in the file.
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.
Added both code actions in commit1afb500:
- "Add import for '{0}'" - simplifies only the current occurrence
- "Add import for '{0}' and simplify all occurrences" - finds all types from the namespace in the file and simplifies them
…spaceCo-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
Summary
This PR implements a new code refactoring that offers to add using directives for fully qualified type names and simplify them.
Changes
AbstractAddImportCodeRefactoringProviderinsrc/Features/Core/Portable/AddImport/CSharpAddImportCodeRefactoringProviderinsrc/Features/CSharp/Portable/AddImport/Behavior
Original prompt
✨ Let Copilot coding agentset things up for you — coding agent works faster and does higher quality work when set up for your repo.