-
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
Semantic snippets: Work on ctor
snippet after modifiers
#71869
Conversation
src/Features/CSharp/Portable/Snippets/CSharpConstructorSnippetProvider.cs
Show resolved
Hide resolved
src/Features/CSharp/Portable/Snippets/CSharpConstructorSnippetProvider.cs
Show resolved
Hide resolved
@sharwell What are we gonna do with this PR? |
@DoctorKrolic My PR to fix this is going to be in #71872. I was delayed by the unexpected failure in the integration test pipeline but should be able to move it forward over the next few hours. |
I'll wait for it to merge first and then fix this one considering its changes. I'll appreciate if you prioritize it a bit to unblock me though |
...t/Completion/CompletionProviders/Snippets/CSharpConstructorSnippetCompletionProviderTests.cs
Show resolved
Hide resolved
Looks good, thanks for the contribution @DoctorKrolic! |
Originally I wanted to make
ctor
snippet appear after accessibility modifiers andstatic
keyword, so user can type e.g.private ctor
and immediately get private constructor instead of either typing it all himself or changing accessibility modifier after activatingctor
snippet. Part of that work required to moveGenerateSnippetTextChangeAsync
toCSharpConstructorSnippetProvider
sincePrecedingModifiers
are only available on C# level. I refactored the method to use more C#-specific APIs to get other things, e.g. usedCSharpSyntaxContext.ContainingTypeDeclaration
instead of searching for node ourselves. As it turned out, these APIs are smarter and handle some edge cases, that were not handled before. So this PR also:Fixes #68176
Fixes AB#1818584
Closes #68177 (as a replacement)