-
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
Add semicolon as a commit character for object creation and symbol completion #48851
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
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.
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
item = item | ||
.AddProperty("SymbolKind", ((int)symbol.Kind).ToString()) | ||
.AddProperty("SymbolName", symbol.Name); | ||
|
||
return isGeneric ? item.AddProperty("IsGeneric", isGeneric.ToString()) : item; | ||
} | ||
|
||
public static CompletionItem AddShouldProvideParenthesisCompletion(CompletionItem item) |
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.
Add comment that this is used like a flag so value doesn't matter
@@ -53,6 +53,9 @@ public static Task<CompletionDescription> GetDescriptionAsync(CompletionItem ite | |||
public static CompletionDescription GetDescription(CompletionItem item) | |||
=> CommonCompletionItem.GetDescription(item); | |||
|
|||
public static bool GetShouldProvideParenthesisCompletion(CompletionItem item) |
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.
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. |
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.
TIL this is not allowed :)
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.
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.