public VisualStudioTodoCommentsService(
            VisualStudioWorkspaceImpl workspace,
            IGlobalOptionService globalOptions,
            IThreadingContext threadingContext,
            IAsynchronousOperationListenerProvider asynchronousOperationListenerProvider,
            [ImportMany] IEnumerable <Lazy <IEventListener, EventListenerMetadata> > eventListeners)
            : base(threadingContext)
        {
            _workspace            = workspace;
            _eventListenerTracker = new EventListenerTracker <ITodoListProvider>(eventListeners, WellKnownEventListeners.TodoListProvider);

            _listener = new TodoCommentsListener(
                globalOptions,
                workspace.Services,
                asynchronousOperationListenerProvider,
                onTodoCommentsUpdated: (documentId, oldComments, newComments) =>
            {
                if (TodoListUpdated != null && !oldComments.SequenceEqual(newComments))
                {
                    TodoListUpdated?.Invoke(
                        this, new TodoItemsUpdatedArgs(
                            documentId, _workspace, _workspace.CurrentSolution,
                            documentId.ProjectId, documentId, newComments));
                }
            },
                threadingContext.DisposalToken);
        }
Example #2
0
 private void OnTodoListChanged(TodoListAction action, TodoItem item)
 => TodoListUpdated?.Invoke(this, new TodoListEventArgs(action, item));