提交 86cd3eef 编写于 作者: J Joey Robichaud

Use Properties indexer instead of Add() to track pasted span

上级 52f044c2
......@@ -36,6 +36,10 @@ protected override TestWorkspace CreateWorkspaceFromFile(string initialMarkup, T
if (!pastedTextSpan.IsEmpty)
{
var pasteTrackingService = workspace.ExportProvider.GetExportedValue<PasteTrackingService>();
// This tests the paste tracking service's resiliancy to failing when multiple pasted spans are
// registered consecutively and that the last registered span wins.
pasteTrackingService.RegisterPastedTextSpan(hostDocument.TextBuffer, default);
pasteTrackingService.RegisterPastedTextSpan(hostDocument.TextBuffer, pastedTextSpan);
}
......
......@@ -44,7 +44,7 @@ internal void RegisterPastedTextSpan(ITextBuffer textBuffer, TextSpan textSpan)
// Any change to the TextBuffer will remove the pasted text span.
// This includes consecutive paste operations which will fire the
// Changed event prior to the handler registering a new text span.
textBuffer.Properties.AddProperty(_pastedTextSpanKey, textSpan);
textBuffer.Properties[_pastedTextSpanKey] = textSpan;
textBuffer.Changed += RemovePastedTextSpan;
return;
......
......@@ -28,6 +28,10 @@ Namespace Microsoft.CodeAnalysis.AddMissingImports
If Not pastedTextSpan.IsEmpty Then
Dim PasteTrackingService = Workspace.ExportProvider.GetExportedValue(Of PasteTrackingService)()
' This tests the paste tracking service's resiliancy to failing when multiple pasted spans are
' registered consecutively And that the last registered span wins.
PasteTrackingService.RegisterPastedTextSpan(hostDocument.TextBuffer, Nothing)
PasteTrackingService.RegisterPastedTextSpan(hostDocument.TextBuffer, pastedTextSpan)
End If
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册