public AntlrTaggerBase(ITextBuffer textBuffer, IEqualityComparer <TState> stateComparer = null, ClassifierOptions options = ClassifierOptions.None)
        {
            Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer");

            _textBuffer    = textBuffer;
            _stateComparer = stateComparer ?? EqualityComparer <TState> .Default;
            _options       = options;

            ITextSnapshot snapshot = textBuffer.CurrentSnapshot;

            _lineStates.AddRange(Enumerable.Repeat(GetStartState().CreateDirtyState(), snapshot.LineCount));
            _lineStatesVersion = snapshot.Version;
            if ((options & ClassifierOptions.ManualUpdate) == 0)
            {
                SubscribeEvents();
            }

            ForceRetagLines(0, textBuffer.CurrentSnapshot.LineCount - 1);
        }
示例#2
0
        public AntlrClassifierBase([NotNull] ITextBuffer textBuffer, [NotNull] IEqualityComparer <TState> stateComparer, ClassifierOptions options)
        {
            Requires.NotNull(textBuffer, nameof(textBuffer));
            Requires.NotNull(stateComparer, nameof(stateComparer));

            _textBuffer    = textBuffer;
            _stateComparer = stateComparer;
            _options       = options;

            ITextSnapshot   currentSnapshot = textBuffer.CurrentSnapshot;
            ClassifierState classifierState = new ClassifierState(currentSnapshot);

            _lineStatesCache.Add(currentSnapshot, classifierState);
            if ((options & ClassifierOptions.ManualUpdate) == 0)
            {
                SubscribeEvents();
            }

            ForceReclassifyLines(classifierState, 0, currentSnapshot.LineCount - 1);
        }
        public AntlrClassifierBase(ITextBuffer textBuffer, IEqualityComparer <TState> stateComparer, ClassifierOptions options)
        {
            Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer");
            Contract.Requires <ArgumentNullException>(stateComparer != null, "stateComparer");

            _textBuffer    = textBuffer;
            _stateComparer = stateComparer;
            _options       = options;

            ITextSnapshot   currentSnapshot = textBuffer.CurrentSnapshot;
            ClassifierState classifierState = new ClassifierState(currentSnapshot);

            _lineStatesCache.Add(currentSnapshot, classifierState);
            if ((options & ClassifierOptions.ManualUpdate) == 0)
            {
                SubscribeEvents();
            }

            ForceReclassifyLines(classifierState, 0, currentSnapshot.LineCount - 1);
        }
 public BraceLevelTracker(ITextBuffer textBuffer, ClassifierOptions options)
     : base(textBuffer)
 {
     Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer");
 }