Skip to content

Commit c49efbd

Browse files
Remove legacy signature help interaction code. (#76495)
2 parents 4234893 + 549eca4 commit c49efbd

File tree

11 files changed

+58
-545
lines changed

11 files changed

+58
-545
lines changed

src/EditorFeatures/Core.Wpf/SignatureHelp/Controller_NavigationKeys.cs

Lines changed: 0 additions & 67 deletions
This file was deleted.

src/EditorFeatures/Core.Wpf/SignatureHelp/SignatureHelpAfterCompletionCommandHandler.cs

Lines changed: 0 additions & 101 deletions
This file was deleted.

src/EditorFeatures/Core.Wpf/SignatureHelp/SignatureHelpBeforeCompletionCommandHandler.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,11 @@
2020
namespace Microsoft.CodeAnalysis.Editor.CommandHandlers
2121
{
2222
/// <summary>
23-
/// There are two forms of intellisense that may be active at the same time. Completion and
24-
/// SigHelp. Completion precedes SigHelp in the command handler because it wants to make sure
25-
/// it's operating on a buffer *after* Completion has changed it. i.e. if "WriteL(" is typed,
26-
/// sig help wants to allow completion to complete that to "WriteLine(" before it tried to
27-
/// proffer sig help. If we were to reverse things, then we'd get a bogus situation where sig
28-
/// help would see "WriteL(" would have nothing to offer and would return.
29-
///
30-
/// However, despite wanting sighelp to receive typechar first and then defer it to completion,
31-
/// we want completion to receive other events first (like escape, and navigation keys). We
32-
/// consider completion to have higher priority for those commands. In order to accomplish that,
33-
/// we introduced <see cref="SignatureHelpAfterCompletionCommandHandler"/>
34-
/// This command handler then delegates escape, up and down to those command handlers.
35-
/// It is called before <see cref="PredefinedCompletionNames.CompletionCommandHandler"/>.
23+
/// There are two forms of intellisense that may be active at the same time. Completion and SigHelp. Completion
24+
/// precedes SigHelp in the command handler because it wants to make sure it's operating on a buffer *after*
25+
/// Completion has changed it. i.e. if "WriteL(" is typed, sig help wants to allow completion to complete that to
26+
/// "WriteLine(" before it tried to proffer sig help. If we were to reverse things, then we'd get a bogus situation
27+
/// where sig help would see "WriteL(" would have nothing to offer and would return.
3628
/// </summary>
3729
[Export]
3830
[Export(typeof(ICommandHandler))]

src/EditorFeatures/Core/IntelliSense/AbstractController.cs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Microsoft.VisualStudio.Text.Editor;
1313
using Roslyn.Utilities;
1414
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
15+
using System.Threading.Tasks;
1516

1617
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense;
1718

@@ -77,11 +78,11 @@ private void OnTextViewClosed(object sender, EventArgs e)
7778
this.TextView.TextBuffer.PostChanged -= this.OnTextViewBufferPostChanged;
7879
}
7980

80-
public TModel WaitForController()
81+
public Task WaitForModelComputation_ForTestingPurposesOnlyAsync()
8182
{
8283
this.ThreadingContext.ThrowIfNotOnUIThread();
8384
VerifySessionIsActive();
84-
return sessionOpt.WaitForController();
85+
return sessionOpt.WaitForModelComputation_ForTestingPurposesOnlyAsync();
8586
}
8687

8788
void IController<TModel>.OnModelUpdated(TModel result, bool updateController)
@@ -136,26 +137,4 @@ public void StopModelComputation()
136137
sessionOpt = null;
137138
localSession.Stop();
138139
}
139-
140-
public bool TryHandleEscapeKey()
141-
{
142-
this.ThreadingContext.ThrowIfNotOnUIThread();
143-
144-
// Escape simply dismissed a session if it's up. Otherwise let the next thing in the
145-
// chain handle us.
146-
if (!IsSessionActive)
147-
{
148-
return false;
149-
}
150-
151-
// If we haven't even computed a model yet, then also send this command to anyone
152-
// listening. It's unlikely that the command was intended for us (as we wouldn't
153-
// have even shown ui yet.
154-
var handledCommand = sessionOpt.InitialUnfilteredModel != null;
155-
156-
// In the presence of an escape, we always stop what we're doing.
157-
this.StopModelComputation();
158-
159-
return handledCommand;
160-
}
161140
}

src/EditorFeatures/Core/IntelliSense/ISession.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#nullable disable
66

7+
using System.Threading.Tasks;
8+
79
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense;
810

911
internal interface ISession<TModel>
@@ -12,5 +14,5 @@ internal interface ISession<TModel>
1214

1315
void Stop();
1416

15-
TModel WaitForController();
17+
Task WaitForModelComputation_ForTestingPurposesOnlyAsync();
1618
}

src/EditorFeatures/Core/IntelliSense/ModelComputation.cs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense;
1818

19-
internal class ModelComputation<TModel> where TModel : class
19+
internal sealed class ModelComputation<TModel> where TModel : class
2020
{
2121
#region Fields that can be accessed from either thread
2222

@@ -81,23 +81,10 @@ public Task<TModel> ModelTask
8181
}
8282
}
8383

84-
public TModel WaitForController()
85-
{
86-
ThreadingContext.ThrowIfNotOnUIThread();
87-
88-
var model = ModelTask.WaitAndGetResult(CancellationToken.None);
89-
if (!_notifyControllerTask.IsCompleted)
90-
{
91-
OnModelUpdated(model, updateController: true);
92-
93-
// Reset lastTask so controller.OnModelUpdated is only called once
94-
_lastTask = Task.FromResult(model);
95-
}
96-
97-
return model;
98-
}
84+
public Task WaitForModelComputation_ForTestingPurposesOnlyAsync()
85+
=> ModelTask;
9986

100-
public virtual void Stop()
87+
public void Stop()
10188
{
10289
ThreadingContext.ThrowIfNotOnUIThread();
10390

src/EditorFeatures/Core/IntelliSense/Session.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#nullable disable
66

77
using System;
8+
using System.Threading.Tasks;
89
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
910
using Roslyn.Utilities;
1011

@@ -52,9 +53,9 @@ public virtual void Stop()
5253
this.PresenterSession.Dismiss();
5354
}
5455

55-
public TModel WaitForController()
56+
public Task WaitForModelComputation_ForTestingPurposesOnlyAsync()
5657
{
5758
Computation.ThreadingContext.ThrowIfNotOnUIThread();
58-
return Computation.WaitForController();
59+
return Computation.WaitForModelComputation_ForTestingPurposesOnlyAsync();
5960
}
6061
}

src/EditorFeatures/Test2/IntelliSense/CSharpSignatureHelpCommandHandlerTests.vb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ class C
499499
state.SendEscape()
500500
End If
501501

502-
state.SendUpKey()
502+
state.CurrentSignatureHelpPresenterSession.SelectPreviousItem()
503503
Await state.AssertSelectedSignatureHelpItem("void C.M(int i, int j, int k)")
504504

505505
state.SendTypeChars("1")
@@ -545,7 +545,7 @@ class C
545545
state.SendEscape()
546546
End If
547547

548-
state.SendDownKey()
548+
state.CurrentSignatureHelpPresenterSession.SelectNextItem()
549549
Await state.AssertSelectedSignatureHelpItem("void C.M(int i, string x)")
550550

551551
state.SendTypeChars("1")
@@ -580,7 +580,7 @@ class C
580580
state.SendTypeChars("1, """" ")
581581
Await state.AssertSelectedSignatureHelpItem("void C.M(int i, string x)")
582582

583-
state.SendUpKey()
583+
state.CurrentSignatureHelpPresenterSession.SelectPreviousItem()
584584
Await state.AssertSelectedSignatureHelpItem("void C.M(int i, int j)")
585585

586586
state.SendTypeChars(",")

0 commit comments

Comments
 (0)