Add semicolon as a commit character for object creation and symbol completion#48851
Add semicolon as a commit character for object creation and symbol completion#48851Cosifne merged 41 commits intodotnet:masterfrom
Conversation
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
|
Tag @genlu in case you didn't see this PR 😀 |
src/Features/CSharp/Portable/Completion/CompletionProviders/ObjectCreationCompletionProvider.cs
Outdated
Show resolved
Hide resolved
In addition to that, I think this could be supported by import completion as well. For those items, we either can recover the symbol from item (for extension methods) or have the fully qualified name to find the symbol from compilation (for type). |
src/Features/CSharp/Portable/Completion/CompletionProviders/SymbolCompletionProvider.cs
Outdated
Show resolved
Hide resolved
genlu
left a comment
There was a problem hiding this comment.
I have some perf concerns, let's figure out if the calculation can be reduced and delay to commit time (also, it might worth to get some perf traces to confirm it.) And ideally, I'd like to implement this feature in all relevant providers to ensure a consistent user experience, at least for the ones we own if coordinating with intellicode team takes time.
Also, I remember we spent a bunch of time dogfooding the statement completion feature, do we want to do the same for this (either dogfooding private built vsix or via experiment)?
…ne/roslyn into dev/shech/methodCompletion
src/Features/Core/Portable/Completion/Providers/AbstractSymbolCompletionProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/Completion/Providers/AbstractSymbolCompletionProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/Completion/Providers/AbstractSymbolCompletionProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/Completion/CompletionProviders/SymbolCompletionProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/Completion/Providers/SymbolCompletionItem.cs
Outdated
Show resolved
Hide resolved
|
tag @genlu in case you didn't see this |
src/Features/Core/Portable/Completion/Providers/SymbolCompletionItem.cs
Outdated
Show resolved
Hide resolved
|
The code is much easier to understand now, thanks :) |
|
Consider add a few tests to |
...es/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs
Show resolved
Hide resolved
...e/Portable/Completion/Providers/ImportCompletionProvider/AbstractImportCompletionProvider.cs
Outdated
Show resolved
Hide resolved
|
LGTM, just some minor comments. Are you planning to add "." support next? |
@genlu |
src/Features/Core/Portable/Completion/Providers/SymbolCompletionItem.cs
Outdated
Show resolved
Hide resolved
| return isGeneric ? item.AddProperty("IsGeneric", isGeneric.ToString()) : item; | ||
| } | ||
|
|
||
| public static CompletionItem AddShouldProvideParenthesisCompletion(CompletionItem item) |
There was a problem hiding this comment.
Add comment that this is used like a flag so value doesn't matter
| public static CompletionDescription GetDescription(CompletionItem item) | ||
| => CommonCompletionItem.GetDescription(item); | ||
|
|
||
| public static bool GetShouldProvideParenthesisCompletion(CompletionItem item) |
There was a problem hiding this comment.
Not sure if you added this because you saw my (now deleted) comment, but I think this is actually unnecessary, since intelliccode controls both creation of the item and create the change
| // However, for an extension method like | ||
| // static class C { public static int ToInt(this Bar b) => 1; } | ||
| // it can only be used as like: bar.ToInt(); | ||
| // bar.ToInt is illegal since it can't be assign to delegate. |
When trying to complete a method or a type in object creation context by a semicolon, append ();
Put the caret between parenthesis based on if the method/constructor takes a parameter.
Partially resolved #12363
Also need to sync with the intellicode team to make some similar changes to PythiaCompletionProvider.