提交 cfa2d9e3 编写于 作者: C Cyrus Najmabadi

Remove unused method from sighelp

上级 1d4a8a99
......@@ -10,8 +10,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense
{
internal interface IDocumentProvider
{
Task<Document> GetDocumentAsync(ITextSnapshot snapshot, CancellationToken cancellationToken);
Document GetOpenDocumentInCurrentContextWithChanges(ITextSnapshot snapshot);
Document GetDocument(ITextSnapshot snapshot, CancellationToken cancellationToken);
}
internal class DocumentProvider : ForegroundThreadAffinitizedObject, IDocumentProvider
......@@ -21,16 +20,10 @@ public DocumentProvider(IThreadingContext threadingContext)
{
}
public Task<Document> GetDocumentAsync(ITextSnapshot snapshot, CancellationToken cancellationToken)
public Document GetDocument(ITextSnapshot snapshot, CancellationToken cancellationToken)
{
AssertIsBackground();
return Task.FromResult(snapshot.AsText().GetDocumentWithFrozenPartialSemantics(cancellationToken));
}
public Document GetOpenDocumentInCurrentContextWithChanges(ITextSnapshot snapshot)
{
var text = snapshot.AsText();
return text.GetOpenDocumentInCurrentContextWithChanges();
return snapshot.AsText().GetDocumentWithFrozenPartialSemantics(cancellationToken);
}
}
}
......@@ -55,7 +55,7 @@ internal partial class Session
AssertIsBackground();
cancellationToken.ThrowIfCancellationRequested();
var document = await Controller.DocumentProvider.GetDocumentAsync(caretPosition.Snapshot, cancellationToken).ConfigureAwait(false);
var document = Controller.DocumentProvider.GetDocument(caretPosition.Snapshot, cancellationToken);
if (document == null)
{
return currentModel;
......
......@@ -25,7 +25,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
<WpfFact>
Public Sub InvokeSignatureHelpWithoutDocumentShouldNotStartNewSession()
Dim emptyProvider = New Mock(Of IDocumentProvider)
emptyProvider.Setup(Function(p) p.GetDocumentAsync(It.IsAny(Of ITextSnapshot), It.IsAny(Of CancellationToken))).Returns(Task.FromResult(DirectCast(Nothing, Document)))
emptyProvider.Setup(Function(p) p.GetDocument(It.IsAny(Of ITextSnapshot), It.IsAny(Of CancellationToken))).Returns(DirectCast(Nothing, Document))
Dim controller As Controller = CreateController(documentProvider:=emptyProvider)
controller.WaitForController()
......@@ -217,7 +217,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
New TypeCharCommandArgs(CreateMock(Of ITextView), CreateMock(Of ITextBuffer), "a"c),
Sub() GetMocks(controller).Buffer.Insert(0, "a"), TestCommandExecutionContext.Create())
GetMocks(controller).DocumentProvider.Verify(Function(p) p.GetDocumentAsync(It.IsAny(Of ITextSnapshot), It.IsAny(Of CancellationToken)), Times.Never)
GetMocks(controller).DocumentProvider.Verify(Function(p) p.GetDocument(It.IsAny(Of ITextSnapshot), It.IsAny(Of CancellationToken)), Times.Never)
End Sub
Private Shared ReadOnly s_controllerMocksMap As New ConditionalWeakTable(Of Controller, ControllerMocks)
......@@ -251,8 +251,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
Dim asyncListener = New Mock(Of IAsynchronousOperationListener)
If documentProvider Is Nothing Then
documentProvider = New Mock(Of IDocumentProvider)
documentProvider.Setup(Function(p) p.GetDocumentAsync(It.IsAny(Of ITextSnapshot), It.IsAny(Of CancellationToken))).Returns(Task.FromResult(document))
documentProvider.Setup(Function(p) p.GetOpenDocumentInCurrentContextWithChanges(It.IsAny(Of ITextSnapshot))).Returns(document)
documentProvider.Setup(Function(p) p.GetDocument(It.IsAny(Of ITextSnapshot), It.IsAny(Of CancellationToken))).Returns(document)
End If
If provider Is Nothing Then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册