// 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.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.Shared.Tagging;
using Microsoft.CodeAnalysis.Options;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
namespace Microsoft.CodeAnalysis.Editor.Tagging
{
///
/// Flags that affect how the tagger infrastructure responds to caret changes.
///
[Flags]
internal enum TaggerCaretChangeBehavior
{
///
/// No special caret change behavior.
///
None = 0,
///
/// If the caret moves outside of a tag, immediately remove all existing tags.
///
RemoveAllTagsOnCaretMoveOutsideOfTag = 1 << 0,
}
///
/// Data source for the . This type tells the
/// when tags need to be recomputed, as well
/// as producing the tags when requested.
///
internal interface IAsynchronousTaggerDataSource where TTag : ITag
{
///
/// The behavior the tagger engine will have when text changes happen to the subject buffer
/// it is attached to. Most taggers can simply use .
/// However, advanced taggers that want to perform specialized behavior depending on what has
/// actually changed in the file can specify .
///
/// If this is specified the tagger engine will track text changes and pass them along as
/// when calling
/// .
///
TaggerTextChangeBehavior TextChangeBehavior { get; }
///
/// The bahavior the tagger will have when changes happen to the caret.
///
TaggerCaretChangeBehavior CaretChangeBehavior { get; }
///
/// The behavior of tags that are created by the async tagger. This will matter for tags
/// created for a previous version of a document that are mapped forward by the async
/// tagging architecture. This value cannot be .
///
SpanTrackingMode SpanTrackingMode { get; }
///
/// Whether or not the the first set of tags for this tagger should be computed synchronously.
///
bool ComputeTagsSynchronouslyIfNoAsynchronousComputationHasCompleted { get; }
///
/// Options controlling this tagger. The tagger infrastructure will check this option
/// against the buffer it is associated with to see if it should tag or not.
///
/// An empty enumerable, or null, can be returned to indicate that this tagger should
/// run unconditionally.
///
IEnumerable