public LintTagger(LintChecker lintChecker) { _lintChecker = lintChecker; _snapshot = lintChecker.LastErrorsSnapshot; lintChecker.AddTagger(this); }
public void Invoke(CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return; } var span = LintChecker.RangeToSpan(_fix.FromRange, _lintError.Span.Snapshot); span.Snapshot.TextBuffer.Replace(span, _fix.ToText); }
public void RemoveLintChecker(LintChecker lintChecker) { // This call will always happen on the UI thread (it is a side-effect of adding or removing the 1st/last tagger). lock (_managers) { _lintCheckers.Remove(lintChecker); foreach (var manager in _managers) { manager.Remove(lintChecker); } } }
public void AddLintChecker(LintChecker lintChecker) { // This call will always happen on the UI thread (it is a side-effect of adding or removing the 1st/last tagger). lock (_managers) { _lintCheckers.Add(lintChecker); // Tell the preexisting managers about the new lint checker foreach (var manager in _managers) { manager.Add(lintChecker); } } }
private bool TryGetLintChecker(out LintChecker checker) { // return cached value if (_lintChecker != null) { checker = _lintChecker; return(true); } if (!_textBuffer.Properties.TryGetProperty(typeof(LintChecker), out checker)) { return(false); } if (checker.IsDisposed || checker.RefCount == 0 || checker.Linting == null) { return(false); } // cache value _lintChecker = checker; _lintChecker.Updated += OnSuggestedActionsChanged; return(true); }
public void Remove(LintChecker lintChecker) { _sink.RemoveFactory(lintChecker.Factory); }
public void Add(LintChecker lintChecker) { _sink.AddFactory(lintChecker.Factory); }