提交 0551dc71 编写于 作者: H Heejae Chang

Merge pull request #4369 from heejaechang/deadcode2

removed more dead code related to old ITaskItem.
......@@ -288,13 +288,9 @@
<Compile Include="Extensibility\SignatureHelp\SignatureHelpParameter.cs" />
<Compile Include="Extensibility\SignatureHelp\SignatureHelpTriggerInfo.cs" />
<Compile Include="Extensibility\SignatureHelp\SignatureHelpTriggerReason.cs" />
<Compile Include="Extensibility\TaskList\AbstractTaskItem.cs" />
<Compile Include="Extensibility\TaskList\IErrorTaskItem.cs" />
<Compile Include="Extensibility\TaskList\ITaskItem.cs" />
<Compile Include="Extensibility\TaskList\ITodoListProvider.cs" />
<Compile Include="Extensibility\TaskList\PredefinedTaskItemTypes.cs" />
<Compile Include="Extensibility\TaskList\TaskItem.cs" />
<Compile Include="Extensibility\TaskList\TaskListEventArgs.cs" />
<Compile Include="Implementation\TodoComment\ITodoListProvider.cs" />
<Compile Include="Implementation\TodoComment\TodoItem.cs" />
<Compile Include="Implementation\TodoComment\TodoListEventArgs.cs" />
<Compile Include="Host\ICallHierarchyPresenter.cs" />
<Compile Include="Host\IPreviewPaneService.cs" />
<Compile Include="Host\INavigableItemsPresenter.cs" />
......@@ -659,7 +655,6 @@
<Compile Include="Implementation\TodoComment\TodoCommentOptions.cs" />
<Compile Include="Implementation\TodoComment\TodoCommentState.cs" />
<Compile Include="Implementation\TodoComment\TodoCommentTokens.cs" />
<Compile Include="Implementation\TodoComment\TodoTaskItem.cs" />
<Compile Include="Implementation\Workspaces\EditorErrorReportingService.cs" />
<Compile Include="Implementation\Workspaces\EditorErrorReportingServiceFactory.cs" />
<Compile Include="Implementation\Workspaces\ProjectCacheServiceFactory.cs" />
......@@ -690,7 +685,6 @@
<Compile Include="Options\NavigationBarOptions.cs" />
<Compile Include="Options\SignatureHelpOptions.cs" />
<Compile Include="Shared\SuggestionSupport\DefaultDocumentSupportsSuggestionService.cs" />
<Compile Include="Shared\Diagnostics\DiagnosticTaskItem.cs" />
<Compile Include="Shared\Extensions\DependencyObjectExtensions.cs" />
<Compile Include="Shared\Extensions\GlyphExtensions.cs" />
<Compile Include="Shared\Extensions\IBraceMatchingServiceExtensions.cs" />
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.Editor
{
internal interface IErrorTaskItem : ITaskItem
{
string Id { get; }
ProjectId ProjectId { get; }
DiagnosticSeverity Severity { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.Editor
{
internal interface ITaskItem
{
string Message { get; }
Workspace Workspace { get; }
DocumentId DocumentId { get; }
/// <summary>
/// Null if path is not mapped and <see cref="OriginalFilePath"/> contains the actual path.
/// Note that the value might be a relative path. In that case <see cref="OriginalFilePath"/> should be used
/// as a base path for path resolution.
/// </summary>
string MappedFilePath { get; }
string OriginalFilePath { get; }
int MappedLine { get; }
int MappedColumn { get; }
int OriginalLine { get; }
int OriginalColumn { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.Editor
{
internal static class PredefinedTaskItemTypes
{
public const string Diagnostic = "Diagnostic";
public const string Todo = "Todo";
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.CodeAnalysis.Editor
{
internal class TaskItem : AbstractTaskItem
{
private readonly string _message;
private readonly Workspace _workspace;
private readonly DocumentId _documentId;
private readonly string _mappedFilePath;
private readonly string _originalFilePath;
private readonly int _mappedLine;
private readonly int _mappedColumn;
private readonly int _originalLine;
private readonly int _originalColumn;
public TaskItem(
string message,
Workspace workspace,
DocumentId documentId,
int mappedLine,
int originalLine,
int mappedColumn,
int originalColumn,
string mappedFilePath,
string originalFilePath)
{
_message = message;
_workspace = workspace;
_documentId = documentId;
_mappedLine = mappedLine;
_mappedColumn = mappedColumn;
_mappedFilePath = mappedFilePath;
_originalLine = originalLine;
_originalColumn = originalColumn;
_originalFilePath = originalFilePath;
}
public override string Message
{
get { return _message; }
}
public override Workspace Workspace
{
get { return _workspace; }
}
public override DocumentId DocumentId
{
get { return _documentId; }
}
public override string MappedFilePath
{
get { return _mappedFilePath; }
}
public override string OriginalFilePath
{
get { return _originalFilePath; }
}
public override int MappedLine
{
get { return _mappedLine; }
}
public override int MappedColumn
{
get { return _mappedColumn; }
}
public override int OriginalLine
{
get { return _originalLine; }
}
public override int OriginalColumn
{
get { return _originalColumn; }
}
}
}
......@@ -39,7 +39,7 @@ public Task DocumentResetAsync(Document document, CancellationToken cancellation
{
// remove cache
_state.Remove(document.Id);
return _state.PersistAsync(document, new Data(VersionStamp.Default, VersionStamp.Default, ImmutableArray<ITaskItem>.Empty), cancellationToken);
return _state.PersistAsync(document, new Data(VersionStamp.Default, VersionStamp.Default, ImmutableArray<TodoItem>.Empty), cancellationToken);
}
public async Task AnalyzeSyntaxAsync(Document document, CancellationToken cancellationToken)
......@@ -90,9 +90,9 @@ public async Task AnalyzeSyntaxAsync(Document document, CancellationToken cancel
}
}
private async Task<ImmutableArray<ITaskItem>> CreateItemsAsync(Document document, IList<TodoComment> comments, CancellationToken cancellationToken)
private async Task<ImmutableArray<TodoItem>> CreateItemsAsync(Document document, IList<TodoComment> comments, CancellationToken cancellationToken)
{
var items = ImmutableArray.CreateBuilder<ITaskItem>();
var items = ImmutableArray.CreateBuilder<TodoItem>();
if (comments != null)
{
var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
......@@ -107,7 +107,7 @@ private async Task<ImmutableArray<ITaskItem>> CreateItemsAsync(Document document
return items.ToImmutable();
}
private ITaskItem CreateItem(Document document, SourceText text, SyntaxTree tree, TodoComment comment)
private TodoItem CreateItem(Document document, SourceText text, SyntaxTree tree, TodoComment comment)
{
var textSpan = new TextSpan(comment.Position, 0);
......@@ -115,7 +115,7 @@ private ITaskItem CreateItem(Document document, SourceText text, SyntaxTree tree
var originalLineInfo = location.GetLineSpan();
var mappedLineInfo = location.GetMappedLineSpan();
return new TodoTaskItem(
return new TodoItem(
comment.Descriptor.Priority,
comment.Message,
document.Project.Solution.Workspace,
......@@ -128,12 +128,12 @@ private ITaskItem CreateItem(Document document, SourceText text, SyntaxTree tree
originalFilePath: document.FilePath);
}
public ImmutableArray<ITaskItem> GetTodoItems(Workspace workspace, DocumentId id, CancellationToken cancellationToken)
public ImmutableArray<TodoItem> GetTodoItems(Workspace workspace, DocumentId id, CancellationToken cancellationToken)
{
var document = workspace.CurrentSolution.GetDocument(id);
if (document == null)
{
return ImmutableArray<ITaskItem>.Empty;
return ImmutableArray<TodoItem>.Empty;
}
// TODO let's think about what to do here. for now, let call it synchronously. also, there is no actual asynch-ness for the
......@@ -142,7 +142,7 @@ public ImmutableArray<ITaskItem> GetTodoItems(Workspace workspace, DocumentId id
var existingData = _state.TryGetExistingDataAsync(document, cancellationToken).WaitAndGetResult(cancellationToken);
if (existingData == null)
{
return ImmutableArray<ITaskItem>.Empty;
return ImmutableArray<TodoItem>.Empty;
}
return existingData.Items;
......@@ -156,12 +156,12 @@ private static bool CheckVersions(Document document, VersionStamp textVersion, V
document.CanReusePersistedSyntaxTreeVersion(syntaxVersion, existingData.SyntaxVersion);
}
internal ImmutableArray<ITaskItem> GetItems_TestingOnly(DocumentId documentId)
internal ImmutableArray<TodoItem> GetItems_TestingOnly(DocumentId documentId)
{
return _state.GetItems_TestingOnly(documentId);
}
private void RaiseTaskListUpdated(Workspace workspace, DocumentId documentId, ImmutableArray<ITaskItem> items)
private void RaiseTaskListUpdated(Workspace workspace, DocumentId documentId, ImmutableArray<TodoItem> items)
{
if (_owner != null)
{
......@@ -173,7 +173,7 @@ public void RemoveDocument(DocumentId documentId)
{
_state.Remove(documentId);
RaiseTaskListUpdated(_workspace, documentId, ImmutableArray<ITaskItem>.Empty);
RaiseTaskListUpdated(_workspace, documentId, ImmutableArray<TodoItem>.Empty);
}
public bool NeedsReanalysisOnOptionChanged(object sender, OptionChangedEventArgs e)
......@@ -185,9 +185,9 @@ private class Data
{
public readonly VersionStamp TextVersion;
public readonly VersionStamp SyntaxVersion;
public readonly ImmutableArray<ITaskItem> Items;
public readonly ImmutableArray<TodoItem> Items;
public Data(VersionStamp textVersion, VersionStamp syntaxVersion, ImmutableArray<ITaskItem> items)
public Data(VersionStamp textVersion, VersionStamp syntaxVersion, ImmutableArray<TodoItem> items)
{
this.TextVersion = textVersion;
this.SyntaxVersion = syntaxVersion;
......
......@@ -17,8 +17,8 @@ internal interface ITodoListProvider
/// When an event handler is newly added, this event will fire for the currently available todo items and then
/// afterward for any changes since.
/// </summary>
event EventHandler<TaskListEventArgs> TodoListUpdated;
event EventHandler<TodoListEventArgs> TodoListUpdated;
ImmutableArray<ITaskItem> GetTodoItems(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken);
ImmutableArray<TodoItem> GetTodoItems(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken);
}
}
......@@ -30,29 +30,29 @@ public IIncrementalAnalyzer CreateIncrementalAnalyzer(Workspace workspace)
new TodoCommentIncrementalAnalyzer(w, w.Services.GetService<IOptionService>(), this, _todoCommentTokens));
}
internal void RaiseTaskListUpdated(object id, Workspace workspace, ProjectId projectId, DocumentId documentId, ImmutableArray<ITaskItem> items)
internal void RaiseTaskListUpdated(object id, Workspace workspace, ProjectId projectId, DocumentId documentId, ImmutableArray<TodoItem> items)
{
var handler = this.TodoListUpdated;
if (handler != null)
{
handler(this, new TaskListEventArgs(Tuple.Create(this, id), PredefinedTaskItemTypes.Todo, workspace, projectId, documentId, items));
handler(this, new TodoListEventArgs(Tuple.Create(this, id), workspace, projectId, documentId, items));
}
}
public event EventHandler<TaskListEventArgs> TodoListUpdated;
public event EventHandler<TodoListEventArgs> TodoListUpdated;
public ImmutableArray<ITaskItem> GetTodoItems(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
public ImmutableArray<TodoItem> GetTodoItems(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
{
var analyzer = TryGetAnalyzer(workspace);
if (analyzer == null)
{
return ImmutableArray<ITaskItem>.Empty;
return ImmutableArray<TodoItem>.Empty;
}
var document = workspace.CurrentSolution.GetDocument(documentId);
if (document == null)
{
return ImmutableArray<ITaskItem>.Empty;
return ImmutableArray<TodoItem>.Empty;
}
return analyzer.GetTodoItems(workspace, document.Id, cancellationToken);
......
......@@ -27,7 +27,7 @@ protected override string StateName
protected override Data TryGetExistingData(Stream stream, Document value, CancellationToken cancellationToken)
{
var list = SharedPools.Default<List<TodoTaskItem>>().AllocateAndClear();
var list = SharedPools.Default<List<TodoItem>>().AllocateAndClear();
try
{
using (var reader = new ObjectReader(stream))
......@@ -43,7 +43,7 @@ protected override Data TryGetExistingData(Stream stream, Document value, Cancel
AppendItems(reader, value, list, cancellationToken);
return new Data(textVersion, dataVersion, list.ToImmutableArray<ITaskItem>());
return new Data(textVersion, dataVersion, list.ToImmutableArray<TodoItem>());
}
}
catch (Exception)
......@@ -52,7 +52,7 @@ protected override Data TryGetExistingData(Stream stream, Document value, Cancel
}
finally
{
SharedPools.Default<List<TodoTaskItem>>().ClearAndFree(list);
SharedPools.Default<List<TodoItem>>().ClearAndFree(list);
}
}
......@@ -66,7 +66,7 @@ protected override void WriteTo(Stream stream, Data data, CancellationToken canc
writer.WriteInt32(data.Items.Length);
foreach (var item in data.Items.OfType<TodoTaskItem>())
foreach (var item in data.Items.OfType<TodoItem>())
{
cancellationToken.ThrowIfCancellationRequested();
......@@ -84,7 +84,7 @@ protected override void WriteTo(Stream stream, Data data, CancellationToken canc
}
}
public ImmutableArray<ITaskItem> GetItems_TestingOnly(DocumentId documentId)
public ImmutableArray<TodoItem> GetItems_TestingOnly(DocumentId documentId)
{
Data data;
if (this.DataCache.TryGetValue(documentId, out data) && data != null)
......@@ -92,10 +92,10 @@ public ImmutableArray<ITaskItem> GetItems_TestingOnly(DocumentId documentId)
return data.Items;
}
return ImmutableArray<ITaskItem>.Empty;
return ImmutableArray<TodoItem>.Empty;
}
private void AppendItems(ObjectReader reader, Document document, List<TodoTaskItem> list, CancellationToken cancellationToken)
private void AppendItems(ObjectReader reader, Document document, List<TodoItem> list, CancellationToken cancellationToken)
{
var count = reader.ReadInt32();
for (var i = 0; i < count; i++)
......@@ -113,7 +113,7 @@ private void AppendItems(ObjectReader reader, Document document, List<TodoTaskIt
var mappedLine = reader.ReadInt32();
var mappedColumn = reader.ReadInt32();
list.Add(new TodoTaskItem(
list.Add(new TodoItem(
priority, message,
document.Project.Solution.Workspace, document.Id,
mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile));
......
......@@ -4,21 +4,58 @@
namespace Microsoft.CodeAnalysis.Editor
{
internal abstract class AbstractTaskItem : ITaskItem
internal sealed class TodoItem
{
public abstract string Message { get; }
public abstract Workspace Workspace { get; }
public abstract DocumentId DocumentId { get; }
public abstract string MappedFilePath { get; }
public abstract string OriginalFilePath { get; }
public abstract int MappedLine { get; }
public abstract int MappedColumn { get; }
public abstract int OriginalLine { get; }
public abstract int OriginalColumn { get; }
public TodoItem(
int priority,
string message,
Workspace workspace,
DocumentId documentId,
int mappedLine,
int originalLine,
int mappedColumn,
int originalColumn,
string mappedFilePath,
string originalFilePath)
{
Priority = priority;
Message = message;
Workspace = workspace;
DocumentId = documentId;
MappedLine = mappedLine;
MappedColumn = mappedColumn;
MappedFilePath = mappedFilePath;
OriginalLine = originalLine;
OriginalColumn = originalColumn;
OriginalFilePath = originalFilePath;
}
public int Priority { get; }
public string Message { get; }
public Workspace Workspace { get; }
public DocumentId DocumentId { get; }
public string MappedFilePath { get; }
public string OriginalFilePath { get; }
public int MappedLine { get; }
public int MappedColumn { get; }
public int OriginalLine { get; }
public int OriginalColumn { get; }
public override bool Equals(object obj)
{
ITaskItem other = obj as ITaskItem;
TodoItem other = obj as TodoItem;
if (other == null)
{
return false;
......@@ -34,41 +71,38 @@ public override int GetHashCode()
public override string ToString()
{
return string.Format("{0} {1} ({2}, {3}) [original: {4} ({5}, {6})]",
Message,
MappedFilePath ?? "",
MappedLine.ToString(),
MappedColumn.ToString(),
OriginalFilePath ?? "",
OriginalLine.ToString(),
OriginalColumn.ToString());
return
$"{Priority} {Message} {MappedFilePath ?? ""} ({MappedLine.ToString()}, {MappedColumn.ToString()}) [original: {OriginalFilePath ?? ""} ({OriginalLine.ToString()}, {OriginalColumn.ToString()})";
}
public static bool Equals(ITaskItem item1, ITaskItem item2)
public static bool Equals(TodoItem item1, TodoItem item2)
{
if (item1.DocumentId != null && item2.DocumentId != null)
{
return item1.DocumentId == item2.DocumentId &&
item1.Priority == item2.Priority &&
item1.Message == item2.Message &&
item1.OriginalLine == item2.OriginalLine &&
item1.OriginalColumn == item2.OriginalColumn;
}
return item1.DocumentId == item2.DocumentId &&
item1.Priority == item2.Priority &&
item1.Message == item2.Message;
}
public static int GetHashCode(ITaskItem item)
public static int GetHashCode(TodoItem item)
{
if (item.DocumentId != null)
{
return Hash.Combine(item.DocumentId,
Hash.Combine(item.Priority,
Hash.Combine(item.Message,
Hash.Combine(item.OriginalLine,
Hash.Combine(item.OriginalColumn, 0))));
Hash.Combine(item.OriginalColumn, 0)))));
}
return (item.Message ?? string.Empty).GetHashCode();
return Hash.Combine(item.Message, item.Priority);
}
}
}
......@@ -5,18 +5,13 @@
namespace Microsoft.CodeAnalysis.Editor
{
internal class TaskListEventArgs : EventArgs
internal class TodoListEventArgs : EventArgs
{
/// <summary>
/// The identity of task item group.
/// </summary>
public object Id { get; }
/// <summary>
/// task item type
/// </summary>
public string TaskListType { get; }
/// <summary>
/// Workspace this task items are associated with
/// </summary>
......@@ -35,19 +30,16 @@ internal class TaskListEventArgs : EventArgs
/// <summary>
/// The task items associated with the ID.
/// </summary>
public ImmutableArray<ITaskItem> TaskItems { get; }
public ImmutableArray<TodoItem> TodoItems { get; }
public TaskListEventArgs(
object id, string type,
Workspace workspace, ProjectId projectId, DocumentId documentId,
ImmutableArray<ITaskItem> taskItems)
public TodoListEventArgs(
object id, Workspace workspace, ProjectId projectId, DocumentId documentId, ImmutableArray<TodoItem> todoItems)
{
this.Id = id;
this.TaskListType = type;
this.Workspace = workspace;
this.ProjectId = projectId;
this.DocumentId = documentId;
this.TaskItems = taskItems;
this.TodoItems = todoItems;
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.TodoComments
{
internal class TodoTaskItem : TaskItem
{
public int Priority { get; }
public TodoTaskItem(
int priority,
string message,
Workspace workspace,
DocumentId documentId,
int mappedLine,
int originalLine,
int mappedColumn,
int originalColumn,
string mappedFilePath,
string originalFilePath) :
base(message, workspace, documentId,
mappedLine, originalLine, mappedColumn, originalColumn, mappedFilePath, originalFilePath)
{
this.Priority = priority;
}
public override bool Equals(object obj)
{
TodoTaskItem other = obj as TodoTaskItem;
if (other == null)
{
return false;
}
return base.Equals(obj) && this.Priority == other.Priority;
}
public override int GetHashCode()
{
return Hash.Combine(base.GetHashCode(), this.Priority);
}
public override string ToString()
{
return string.Format("[{0}] {1}", this.Priority.ToString(), base.ToString());
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.Diagnostics;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Shared.Diagnostics
{
internal sealed class DiagnosticTaskItem : IErrorTaskItem
{
private readonly DiagnosticData _diagnostic;
public DiagnosticTaskItem(DiagnosticData diagnostic)
{
_diagnostic = diagnostic;
}
public string Id
{
get { return _diagnostic.Id; }
}
public ProjectId ProjectId
{
get { return _diagnostic.ProjectId; }
}
public DiagnosticSeverity Severity
{
get { return _diagnostic.Severity; }
}
public string Message
{
get { return _diagnostic.Message; }
}
public Workspace Workspace
{
get { return _diagnostic.Workspace; }
}
public DocumentId DocumentId
{
get { return _diagnostic.DocumentId; }
}
public string MappedFilePath
{
get { return _diagnostic.MappedFilePath; }
}
public string OriginalFilePath
{
get { return _diagnostic.OriginalFilePath; }
}
public int MappedLine
{
get
{
if (this.DocumentId != null)
{
return _diagnostic.MappedStartLine;
}
else
{
throw new InvalidOperationException(EditorFeaturesResources.NotASourceError);
}
}
}
public int MappedColumn
{
get
{
if (this.DocumentId != null)
{
return _diagnostic.MappedStartColumn;
}
else
{
throw new InvalidOperationException(EditorFeaturesResources.NotASourceError);
}
}
}
public int OriginalLine
{
get
{
if (this.DocumentId != null)
{
return _diagnostic.OriginalStartLine;
}
else
{
throw new InvalidOperationException(EditorFeaturesResources.NotASourceError);
}
}
}
public int OriginalColumn
{
get
{
if (this.DocumentId != null)
{
return _diagnostic.OriginalStartColumn;
}
else
{
throw new InvalidOperationException(EditorFeaturesResources.NotASourceError);
}
}
}
public override bool Equals(object obj)
{
IErrorTaskItem other = obj as IErrorTaskItem;
if (other == null)
{
return false;
}
return
AbstractTaskItem.Equals(this, other) &&
Id == other.Id &&
ProjectId == other.ProjectId &&
Severity == other.Severity;
}
public override int GetHashCode()
{
return Hash.Combine(AbstractTaskItem.GetHashCode(this), Hash.Combine(Id.GetHashCode(), (int)Severity));
}
public override string ToString()
{
return string.Format("{0} {1} {2} {3} {4} {5} ({5}, {6}) [original: {7} ({8}, {9})]",
Id,
Message,
Severity.ToString(),
ProjectId,
MappedFilePath ?? "",
MappedLine.ToString(),
MappedColumn.ToString(),
OriginalFilePath ?? "",
OriginalLine.ToString(),
OriginalColumn.ToString());
}
}
}
......@@ -288,20 +288,19 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests
registrationService.Register(workspace)
Dim diagnosticProvider = GetDiagnosticProvider(workspace)
Dim actualDiagnostics = diagnosticProvider.GetCachedDiagnosticsAsync(workspace).Result _
.Select(Function(d) New [Shared].Diagnostics.DiagnosticTaskItem(d))
Dim actualDiagnostics = diagnosticProvider.GetCachedDiagnosticsAsync(workspace).Result
registrationService.Unregister(workspace)
If diagnostics Is Nothing Then
Assert.Equal(0, actualDiagnostics.Count)
Assert.Equal(0, actualDiagnostics.Length)
Else
Dim expectedDiagnostics = GetExpectedDiagnostics(workspace, diagnostics)
If ordered Then
AssertEx.Equal(expectedDiagnostics, actualDiagnostics, EqualityComparer(Of IErrorTaskItem).Default)
AssertEx.Equal(expectedDiagnostics, actualDiagnostics, New Comparer())
Else
AssertEx.SetEqual(expectedDiagnostics, actualDiagnostics, EqualityComparer(Of IErrorTaskItem).Default)
AssertEx.SetEqual(expectedDiagnostics, actualDiagnostics, New Comparer())
End If
End If
End Using
......@@ -324,8 +323,8 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests
Return analyzerService
End Function
Private Function GetExpectedDiagnostics(workspace As TestWorkspace, diagnostics As XElement) As List(Of IErrorTaskItem)
Dim result As New List(Of IErrorTaskItem)
Private Function GetExpectedDiagnostics(workspace As TestWorkspace, diagnostics As XElement) As List(Of DiagnosticData)
Dim result As New List(Of DiagnosticData)
Dim mappedLine As Integer, mappedColumn As Integer, originalLine As Integer, originalColumn As Integer
Dim Id As String, message As String, originalFile As String, mappedFile As String
Dim documentId As DocumentId
......@@ -364,64 +363,45 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests
End Function
Private Function SourceError(id As String, message As String, workspace As Workspace, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer,
mappedColumn As Integer, originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticTaskItem
Return New DiagnosticTaskItem(id, DiagnosticSeverity.Error, message, workspace, docId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
mappedColumn As Integer, originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticData
Return CreateDiagnostic(id, message, DiagnosticSeverity.Error, workspace, docId, projId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
End Function
Private Function SourceWarning(id As String, message As String, workspace As Workspace, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer,
mappedColumn As Integer, originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticTaskItem
Return New DiagnosticTaskItem(id, DiagnosticSeverity.Warning, message, workspace, docId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
mappedColumn As Integer, originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticData
Return CreateDiagnostic(id, message, DiagnosticSeverity.Warning, workspace, docId, projId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
End Function
Private Class DiagnosticTaskItem
Inherits TaskItem
Implements IErrorTaskItem
Private ReadOnly _id As String
Private ReadOnly _projectId As ProjectId
Private ReadOnly _severity As DiagnosticSeverity
Public Sub New(id As String, severity As DiagnosticSeverity, message As String, workspace As Workspace, docId As DocumentId,
mappedLine As Integer, originalLine As Integer, mappedColumn As Integer, originalColumn As Integer, mappedFile As String, originalFile As String)
MyBase.New(message, workspace, docId, mappedLine, originalLine, mappedColumn, originalColumn, mappedFile, originalFile)
Me._id = id
Me._projectId = docId.ProjectId
Me._severity = severity
End Sub
Public ReadOnly Property Id As String Implements IErrorTaskItem.Id
Get
Return Me._id
End Get
End Property
Public ReadOnly Property ProjectId As ProjectId Implements IErrorTaskItem.ProjectId
Get
Return Me._projectId
End Get
End Property
Public ReadOnly Property Severity As DiagnosticSeverity Implements IErrorTaskItem.Severity
Get
Return Me._severity
End Get
End Property
Public Overrides Function Equals(obj As Object) As Boolean
Dim other As IErrorTaskItem = TryCast(obj, IErrorTaskItem)
If other Is Nothing Then
Return False
End If
If Not AbstractTaskItem.Equals(Me, other) Then
Return False
End If
Private Function CreateDiagnostic(id As String, message As String, severity As DiagnosticSeverity, workspace As Workspace, docId As DocumentId, projId As ProjectId, mappedLine As Integer, originalLine As Integer,
mappedColumn As Integer, originalColumn As Integer, mappedFile As String, originalFile As String) As DiagnosticData
Return New DiagnosticData(id, "test", message, message, severity, severity, True, 0,
ImmutableArray(Of String).Empty, ImmutableDictionary(Of String, String).Empty,
workspace, projId, docId, Nothing,
mappedFile, mappedLine, mappedColumn, mappedLine, mappedColumn,
originalFile, originalLine, originalColumn, originalLine, originalColumn,
Nothing, Nothing, Nothing)
End Function
Return Id = other.Id AndAlso ProjectId = other.ProjectId AndAlso Severity = other.Severity
Private Class Comparer
Implements IEqualityComparer(Of DiagnosticData)
Public Overloads Function Equals(x As DiagnosticData, y As DiagnosticData) As Boolean Implements IEqualityComparer(Of DiagnosticData).Equals
Return x.Id = y.Id AndAlso
x.Message = y.Message AndAlso
x.Severity = y.Severity AndAlso
x.ProjectId = y.ProjectId AndAlso
x.DocumentId = y.DocumentId AndAlso
x.OriginalStartLine = y.OriginalStartLine AndAlso
x.OriginalStartColumn = y.OriginalStartColumn
End Function
Public Overrides Function GetHashCode() As Integer
Return Hash.Combine(AbstractTaskItem.GetHashCode(Me), Hash.Combine(Id.GetHashCode(), CType(Severity, Integer)))
Public Overloads Function GetHashCode(obj As DiagnosticData) As Integer Implements IEqualityComparer(Of DiagnosticData).GetHashCode
Return Hash.Combine(obj.Id,
Hash.Combine(obj.Message,
Hash.Combine(obj.ProjectId,
Hash.Combine(obj.DocumentId,
Hash.Combine(obj.OriginalStartLine,
Hash.Combine(obj.OriginalStartColumn, obj.Severity))))))
End Function
End Class
End Class
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Utilities;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Editor.Shared.Diagnostics;
using Microsoft.VisualStudio.LanguageServices.CSharp.ProjectSystemShim.Interop;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;
using Microsoft.VisualStudio.LanguageServices.Implementation.TaskList;
......
......@@ -13,7 +13,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource
[DataSource(MiscellaneousTodoListTable.IdentifierString)]
[Name(Name)]
[Order(Before = "default")]
internal class MiscTodoListTableControlEventProcessorProvider : AbstractTableControlEventProcessorProvider<ITaskItem>
internal class MiscTodoListTableControlEventProcessorProvider : AbstractTableControlEventProcessorProvider<TodoItem>
{
internal const string Name = "Misc C#/VB Todo List Table Event Processor";
}
......
......@@ -13,7 +13,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource
[DataSource(VisualStudioTodoListTable.IdentifierString)]
[Name(Name)]
[Order(Before = "default")]
internal class TodoListTableControlEventProcessorProvider : AbstractTableControlEventProcessorProvider<ITaskItem>
internal class TodoListTableControlEventProcessorProvider : AbstractTableControlEventProcessorProvider<TodoItem>
{
internal const string Name = "C#/VB Todo List Table Event Processor";
}
......
......@@ -18,7 +18,7 @@
namespace Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource
{
internal class VisualStudioBaseTodoListTable : AbstractTable<TaskListEventArgs, TodoTaskItem>
internal class VisualStudioBaseTodoListTable : AbstractTable<TodoListEventArgs, TodoItem>
{
private static readonly string[] s_columns = new string[]
{
......@@ -66,7 +66,7 @@ protected override void ShutdownSource()
_source.Shutdown();
}
private class TableDataSource : AbstractRoslynTableDataSource<TaskListEventArgs, TodoTaskItem>
private class TableDataSource : AbstractRoslynTableDataSource<TodoListEventArgs, TodoItem>
{
private readonly Workspace _workspace;
private readonly string _identifier;
......@@ -86,7 +86,7 @@ public TableDataSource(Workspace workspace, ITodoListProvider todoListProvider,
public override string SourceTypeIdentifier => StandardTableDataSources.CommentTableDataSource;
public override string Identifier => _identifier;
private void OnTodoListUpdated(object sender, TaskListEventArgs e)
private void OnTodoListUpdated(object sender, TodoListEventArgs e)
{
if (_workspace != e.Workspace)
{
......@@ -95,16 +95,16 @@ private void OnTodoListUpdated(object sender, TaskListEventArgs e)
Contract.Requires(e.DocumentId != null);
if (e.TaskItems.Length == 0)
if (e.TodoItems.Length == 0)
{
OnDataRemoved(e.DocumentId);
return;
}
OnDataAddedOrChanged(e.DocumentId, e, e.TaskItems.Length);
OnDataAddedOrChanged(e.DocumentId, e, e.TodoItems.Length);
}
protected override AbstractTableEntriesFactory<TodoTaskItem> CreateTableEntryFactory(object key, TaskListEventArgs data)
protected override AbstractTableEntriesFactory<TodoItem> CreateTableEntryFactory(object key, TodoListEventArgs data)
{
var documentId = (DocumentId)key;
Contract.Requires(documentId == data.DocumentId);
......@@ -112,7 +112,7 @@ protected override AbstractTableEntriesFactory<TodoTaskItem> CreateTableEntryFac
return new TableEntriesFactory(this, data.Workspace, data.DocumentId);
}
private class TableEntriesFactory : AbstractTableEntriesFactory<TodoTaskItem>
private class TableEntriesFactory : AbstractTableEntriesFactory<TodoItem>
{
private readonly TableDataSource _source;
private readonly Workspace _workspace;
......@@ -126,31 +126,31 @@ private class TableEntriesFactory : AbstractTableEntriesFactory<TodoTaskItem>
_documentId = documentId;
}
protected override ImmutableArray<TodoTaskItem> GetItems()
protected override ImmutableArray<TodoItem> GetItems()
{
var provider = _source._todoListProvider;
// TODO: remove this wierd cast once we completely move off legacy task list. we, for now, need this since we share data
// between old and new API.
return provider.GetTodoItems(_workspace, _documentId, CancellationToken.None).Cast<TodoTaskItem>().ToImmutableArray();
return provider.GetTodoItems(_workspace, _documentId, CancellationToken.None).Cast<TodoItem>().ToImmutableArray();
}
protected override ImmutableArray<ITrackingPoint> GetTrackingPoints(ImmutableArray<TodoTaskItem> items)
protected override ImmutableArray<ITrackingPoint> GetTrackingPoints(ImmutableArray<TodoItem> items)
{
return CreateTrackingPoints(_workspace, _documentId, items, (d, s) => CreateTrackingPoint(s, d.OriginalLine, d.OriginalColumn));
}
protected override AbstractTableEntriesSnapshot<TodoTaskItem> CreateSnapshot(int version, ImmutableArray<TodoTaskItem> items, ImmutableArray<ITrackingPoint> trackingPoints)
protected override AbstractTableEntriesSnapshot<TodoItem> CreateSnapshot(int version, ImmutableArray<TodoItem> items, ImmutableArray<ITrackingPoint> trackingPoints)
{
return new TableEntriesSnapshot(this, version, items, trackingPoints);
}
private class TableEntriesSnapshot : AbstractTableEntriesSnapshot<TodoTaskItem>
private class TableEntriesSnapshot : AbstractTableEntriesSnapshot<TodoItem>
{
private readonly TableEntriesFactory _factory;
public TableEntriesSnapshot(
TableEntriesFactory factory, int version, ImmutableArray<TodoTaskItem> items, ImmutableArray<ITrackingPoint> trackingPoints) :
TableEntriesFactory factory, int version, ImmutableArray<TodoItem> items, ImmutableArray<ITrackingPoint> trackingPoints) :
base(version, GetProjectGuid(factory._workspace, factory._documentId.ProjectId), items, trackingPoints)
{
_factory = factory;
......@@ -199,7 +199,7 @@ public override bool TryGetValue(int index, string columnName, out object conten
}
}
private LinePosition GetLineColumn(TodoTaskItem item)
private LinePosition GetLineColumn(TodoItem item)
{
return VisualStudioVenusSpanMappingService.GetAdjustedLineColumn(
_factory._workspace,
......@@ -227,7 +227,7 @@ public override bool TryNavigateTo(int index, bool previewTab)
return TryNavigateTo(_factory._workspace, _factory._documentId, item.OriginalLine, item.OriginalColumn, previewTab);
}
protected override bool IsEquivalent(TodoTaskItem item1, TodoTaskItem item2)
protected override bool IsEquivalent(TodoItem item1, TodoItem item2)
{
// everything same except location
return item1.DocumentId == item2.DocumentId && item1.Message == item2.Message;
......
......@@ -26,7 +26,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
Assert.Equal(manager.Identifier, StandardTables.TasksTable)
Assert.Equal(1, manager.Sources.Count())
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TaskListEventArgs, TodoTaskItem))
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TodoListEventArgs, TodoItem))
AssertEx.SetEqual(table.Columns, manager.GetColumnsForSources(SpecializedCollections.SingletonEnumerable(source)))
Assert.Equal(ServicesVSResources.TodoTableSourceName, source.DisplayName)
......@@ -57,7 +57,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
provider.RaiseTodoListUpdated(workspace)
Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager)
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TaskListEventArgs, TodoTaskItem))
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TodoListEventArgs, TodoItem))
Dim sinkAndSubscription = manager.Sinks_TestOnly.First()
Dim sink = DirectCast(sinkAndSubscription.Key, TestTableManagerProvider.TestTableManager.TestSink)
......@@ -75,16 +75,16 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
Dim table = New VisualStudioTodoListTable(workspace, provider, tableManagerProvider)
Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager)
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TaskListEventArgs, TodoTaskItem))
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TodoListEventArgs, TodoItem))
Dim sinkAndSubscription = manager.Sinks_TestOnly.First()
Dim sink = DirectCast(sinkAndSubscription.Key, TestTableManagerProvider.TestTableManager.TestSink)
provider.Items = New ITaskItem() {CreateItem(workspace, documentId)}
provider.Items = New TodoItem() {CreateItem(workspace, documentId)}
provider.RaiseTodoListUpdated(workspace)
Assert.Equal(1, sink.Entries.Count)
provider.Items = Array.Empty(Of ITaskItem)()
provider.Items = Array.Empty(Of TodoItem)()
provider.RaiseClearTodoListUpdated(workspace, documentId)
Assert.Equal(0, sink.Entries.Count)
End Using
......@@ -103,7 +103,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
provider.RaiseTodoListUpdated(workspace)
Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager)
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TaskListEventArgs, TodoTaskItem))
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TodoListEventArgs, TodoItem))
Dim sinkAndSubscription = manager.Sinks_TestOnly.First()
Dim sink = DirectCast(sinkAndSubscription.Key, TestTableManagerProvider.TestTableManager.TestSink)
......@@ -144,13 +144,13 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
provider.RaiseTodoListUpdated(workspace)
Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager)
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TaskListEventArgs, TodoTaskItem))
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TodoListEventArgs, TodoItem))
Dim sinkAndSubscription = manager.Sinks_TestOnly.First()
Dim sink = DirectCast(sinkAndSubscription.Key, TestTableManagerProvider.TestTableManager.TestSink)
Dim subscription = sinkAndSubscription.Value
Dim factory = TryCast(sink.Entries.First(), AbstractTableEntriesFactory(Of TodoTaskItem))
Dim factory = TryCast(sink.Entries.First(), AbstractTableEntriesFactory(Of TodoItem))
Dim snapshot1 = factory.GetCurrentSnapshot()
factory.OnUpdated(snapshot1.Count)
......@@ -192,13 +192,13 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
provider.RaiseTodoListUpdated(workspace)
Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager)
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TaskListEventArgs, TodoTaskItem))
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TodoListEventArgs, TodoItem))
Dim sinkAndSubscription = manager.Sinks_TestOnly.First()
Dim sink = DirectCast(sinkAndSubscription.Key, TestTableManagerProvider.TestTableManager.TestSink)
Dim subscription = sinkAndSubscription.Value
Dim factory = TryCast(sink.Entries.First(), AbstractTableEntriesFactory(Of TodoTaskItem))
Dim factory = TryCast(sink.Entries.First(), AbstractTableEntriesFactory(Of TodoItem))
Dim snapshot1 = factory.GetCurrentSnapshot()
factory.OnUpdated(snapshot1.Count)
......@@ -222,18 +222,18 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
provider.RaiseTodoListUpdated(workspace)
Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager)
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TaskListEventArgs, TodoTaskItem))
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TodoListEventArgs, TodoItem))
Dim sinkAndSubscription = manager.Sinks_TestOnly.First()
Dim sink = DirectCast(sinkAndSubscription.Key, TestTableManagerProvider.TestTableManager.TestSink)
Dim subscription = sinkAndSubscription.Value
Dim factory = TryCast(sink.Entries.First(), AbstractTableEntriesFactory(Of TodoTaskItem))
Dim factory = TryCast(sink.Entries.First(), AbstractTableEntriesFactory(Of TodoItem))
Dim snapshot1 = factory.GetCurrentSnapshot()
provider.Items = New ITaskItem() {
New TodoTaskItem(1, "test2", workspace, documentId, 11, 11, 21, 21, Nothing, "test2"),
New TodoTaskItem(0, "test", workspace, documentId, 11, 11, 21, 21, Nothing, "test1")}
provider.Items = New TodoItem() {
New TodoItem(1, "test2", workspace, documentId, 11, 11, 21, 21, Nothing, "test2"),
New TodoItem(0, "test", workspace, documentId, 11, 11, 21, 21, Nothing, "test1")}
provider.RaiseTodoListUpdated(workspace)
......@@ -255,18 +255,18 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
provider.RaiseTodoListUpdated(workspace)
Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager)
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TaskListEventArgs, TodoTaskItem))
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TodoListEventArgs, TodoItem))
Dim sinkAndSubscription = manager.Sinks_TestOnly.First()
Dim sink = DirectCast(sinkAndSubscription.Key, TestTableManagerProvider.TestTableManager.TestSink)
Dim subscription = sinkAndSubscription.Value
Dim factory = TryCast(sink.Entries.First(), AbstractTableEntriesFactory(Of TodoTaskItem))
Dim factory = TryCast(sink.Entries.First(), AbstractTableEntriesFactory(Of TodoItem))
Dim snapshot1 = factory.GetCurrentSnapshot()
provider.Items = New ITaskItem() {
New TodoTaskItem(1, "test2", workspace, documentId, 11, 11, 21, 21, Nothing, "test2"),
New TodoTaskItem(0, "test3", workspace, documentId, 11, 11, 21, 21, Nothing, "test3")}
provider.Items = New TodoItem() {
New TodoItem(1, "test2", workspace, documentId, 11, 11, 21, 21, Nothing, "test2"),
New TodoItem(0, "test3", workspace, documentId, 11, 11, 21, 21, Nothing, "test3")}
provider.RaiseTodoListUpdated(workspace)
......@@ -288,7 +288,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
provider.RaiseTodoListUpdated(workspace)
Dim manager = DirectCast(table.TableManager, TestTableManagerProvider.TestTableManager)
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TaskListEventArgs, TodoTaskItem))
Dim source = DirectCast(manager.Sources.First(), AbstractRoslynTableDataSource(Of TodoListEventArgs, TodoItem))
Dim sinkAndSubscription = manager.Sinks_TestOnly.First()
Dim sink = DirectCast(sinkAndSubscription.Key, TestTableManagerProvider.TestTableManager.TestSink)
......@@ -305,22 +305,22 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
End Using
End Sub
Private Function CreateItem(workspace As Workspace, documentId As DocumentId) As ITaskItem
Return New TodoTaskItem(0, "test", workspace, documentId, 10, 10, 20, 20, Nothing, "test1")
Private Function CreateItem(workspace As Workspace, documentId As DocumentId) As TodoItem
Return New TodoItem(0, "test", workspace, documentId, 10, 10, 20, 20, Nothing, "test1")
End Function
Private Class TestTodoListProvider
Implements ITodoListProvider
Public Items As ITaskItem()
Public Items As TodoItem()
Public Sub New(ParamArray items As ITaskItem())
Public Sub New(ParamArray items As TodoItem())
Me.Items = items
End Sub
Public Event TodoListUpdated As EventHandler(Of TaskListEventArgs) Implements ITodoListProvider.TodoListUpdated
Public Event TodoListUpdated As EventHandler(Of TodoListEventArgs) Implements ITodoListProvider.TodoListUpdated
Public Function GetTodoItems(workspace As Workspace, documentId As DocumentId, cancellationToken As CancellationToken) As ImmutableArray(Of ITaskItem) Implements ITodoListProvider.GetTodoItems
Public Function GetTodoItems(workspace As Workspace, documentId As DocumentId, cancellationToken As CancellationToken) As ImmutableArray(Of TodoItem) Implements ITodoListProvider.GetTodoItems
Assert.NotNull(workspace)
Assert.NotNull(documentId)
......@@ -331,14 +331,14 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
Dim map = Items.Where(Function(t) t.Workspace Is workspace).ToLookup(Function(t) t.DocumentId)
For Each group In map
RaiseEvent TodoListUpdated(Me, New TaskListEventArgs(
Tuple.Create(Me, group.Key), PredefinedTaskItemTypes.Todo, workspace, group.Key.ProjectId, group.Key, group.ToImmutableArrayOrEmpty()))
RaiseEvent TodoListUpdated(Me, New TodoListEventArgs(
Tuple.Create(Me, group.Key), workspace, group.Key.ProjectId, group.Key, group.ToImmutableArrayOrEmpty()))
Next
End Sub
Public Sub RaiseClearTodoListUpdated(workspace As Workspace, documentId As DocumentId)
RaiseEvent TodoListUpdated(Me, New TaskListEventArgs(
Tuple.Create(Me, documentId), PredefinedTaskItemTypes.Todo, workspace, documentId.ProjectId, documentId, ImmutableArray(Of ITaskItem).Empty))
RaiseEvent TodoListUpdated(Me, New TodoListEventArgs(
Tuple.Create(Me, documentId), workspace, documentId.ProjectId, documentId, ImmutableArray(Of TodoItem).Empty))
End Sub
End Class
End Class
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册