Skip to content

C# Completion Popup in Argument Lists#42035

Merged
dpoeschl merged 22 commits intodotnet:masterfrom
dpoeschl:CSharpCompletionArgumentListPopup
Mar 16, 2020
Merged

C# Completion Popup in Argument Lists#42035
dpoeschl merged 22 commits intodotnet:masterfrom
dpoeschl:CSharpCompletionArgumentListPopup

Conversation

@dpoeschl
Copy link
Copy Markdown
Contributor

@dpoeschl dpoeschl commented Feb 29, 2020

Today in VB, typing in argument lists automatically triggers completion (when you type a ( or <space>). This change adds this behavior for C# (under an option and an experiment).

@dpoeschl dpoeschl marked this pull request as ready for review March 3, 2020 03:19
@dpoeschl dpoeschl requested a review from a team as a code owner March 3, 2020 03:19
@dpoeschl dpoeschl force-pushed the CSharpCompletionArgumentListPopup branch 3 times, most recently from 8435b0a to d1e5bd5 Compare March 4, 2020 00:47
@dpoeschl dpoeschl force-pushed the CSharpCompletionArgumentListPopup branch from 4c02708 to 2e2bb82 Compare March 6, 2020 18:36
@dpoeschl
Copy link
Copy Markdown
Contributor Author

dpoeschl commented Mar 6, 2020

@CyrusNajmabadi This is still in progress, primarily in tests, but can you take a look based on our design discussion the other day? This should mostly reflect what we discussed (IsSyntacticTriggerCharacterAsync) but I also ended up needing a ShouldProvidePreselectedItemsAsync.

Comment thread src/Features/Core/Portable/Completion/CompletionProvider.cs
Comment thread src/Features/Core/Portable/Completion/CompletionProvider.cs Outdated
Comment thread src/VisualStudio/CSharp/Impl/CSharpVSResources.resx
Comment thread src/Features/Core/Portable/Completion/CompletionProvider.cs

private static bool IsArgumentListTriggerCharacter(char character)
{
return character == ' ' || character == '(' || character == '[';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dupe? use helper?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no shared CompletionUtilities, so I wasn't sure where to put it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:'(

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Overall this looks good. A few concerns:

  1. why is this only touching symbol completion? Does this not impact other completion providers? i.e. in gneeral, when symbol completion is shown, i often expect other completion providers as well (like keywords).
  2. if we add this option, i would like VB to respect it. VB can just have 'null' map to 'true' though. But it would be really nice in VB to be able to disable this behavior and to keep our impls in sync.

Await state.AssertSelectedSignatureHelpItem("void C.M()")
Assert.Equal(4, state.GetSignatureHelpItems().Count)

If showCompletionInArgumentLists Then
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CyrusNajmabadi A couple tests changed in this way. Basically, now that sighelp and completion show up at the same time, completion steals keyboard focus and these tests weren't expecting that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh... yeah. that's why i hate this feature :D

@dpoeschl
Copy link
Copy Markdown
Contributor Author

dpoeschl commented Mar 12, 2020

@CyrusNajmabadi

why is this only touching symbol completion? Does this not impact other completion providers? i.e. in gneeral, when symbol completion is shown, i often expect other completion providers as well (like keywords).

We just want to update the scenarios in which symbols are shown to include these new cases. Why would other providers need to be updated? They'll come along as triggered or augmenting providers as always.

if we add this option, i would like VB to respect it. VB can just have 'null' map to 'true' though. But it would be really nice in VB to be able to disable this behavior and to keep our impls in sync.

I've filed this as #42369

@dpoeschl
Copy link
Copy Markdown
Contributor Author

Realizing I didn't tag @dotnet/roslyn-ide for additional review. So, tag.

@dpoeschl
Copy link
Copy Markdown
Contributor Author

The main contentious behavior change here is when SigHelp and Completion show up at the same time.

Previously, a user could type M( and immediately use the arrow keys to navigate through overloads. With this change, the arrow keys instead go to completion. If completion is dismissed (ESC), then the arrows work in SigHelp as desired.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

CyrusNajmabadi commented Mar 16, 2020

Previously, a user could type M( and immediately use the arrow keys to navigate through overloads. With this change, the arrow keys instead go to completion. If completion is dismissed (ESC), then the arrows work in SigHelp as desired.

I'm not getting the value here. Why do these need to pop up on sig-help chars? Why not just have completion show up naturally (either direct invocation, or typing an id character)? Wouldn't that be enough to show the important items?

@dpoeschl
Copy link
Copy Markdown
Contributor Author

@CyrusNajmabadi Are there any remaining things we'd like to get done before an initial merge here? Can Explicit-SigHelp-Cancels-Completion come in a follow-up? /cc: @jinujoseph

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi Are there any remaining things we'd like to get done before an initial merge here?

Nope. No more work here :)

Great work here btw! Impl is clean and fits nicely into an area that is extremely subtle. I'm def a little worried here, but that's mostly in IntelliCode's court now.

Can Explicit-SigHelp-Cancels-Completion come in a follow-up? /cc: @jinujoseph

Yes. That can come in a followup. Let's def concentrate on high value stuff right now. Just track the above in an issue. Thanks!

@dpoeschl
Copy link
Copy Markdown
Contributor Author

Follow-up issue tracked by #42484

@dpoeschl dpoeschl merged commit 1a3e3c4 into dotnet:master Mar 16, 2020
@ghost ghost added this to the Next milestone Mar 16, 2020
@sharwell sharwell modified the milestones: Next, 16.6.P2 Mar 17, 2020
@vatsalyaagrawal
Copy link
Copy Markdown
Contributor

Design meeting notes:

  • Explicitly triggering signature help should dismiss completion.
  • This is going to be a change for customer, we will leverage dogfooding to get customer feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants