示例#1
0
        public void RemoveIssueTracker(IssueTracker tracker)
        {
            lock (managers)
            {
                trackers.Remove(tracker);

                foreach (var manager in managers)
                {
                    manager.RemoveFactory(tracker.Factory);
                }
            }
        }
示例#2
0
        public void AddIssueTracker(IssueTracker tracker)
        {
            lock (managers)
            {
                trackers.Add(tracker);

                foreach (var manager in managers)
                {
                    manager.AddFactory(tracker.Factory);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Create a tagger that will track Sonar issues on the view/buffer combination.
        /// </summary>
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            if (!daemon.IsRunning)
            {
                return(null);
            }

            // Only attempt to track the view's edit buffer.
            // Multiple views could have that buffer open simultaneously, so only create one instance of the tracker.
            if (buffer != textView.TextBuffer || typeof(T) != typeof(IErrorTag))
            {
                return(null);
            }

            ITextDocument document;

            if (!TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out document))
            {
                return(null);
            }

            var path = document.FilePath;

            // TODO find a better way to detect JavaScript
            if (!path.ToLowerInvariant().EndsWith(".js"))
            {
                return(null);
            }

            lock (trackers)
            {
                if (!trackers.ExistsForFile(path))
                {
                    var tracker = new IssueTracker(this, buffer, document);
                    return(tracker as ITagger <T>);
                }
            }

            return(null);
        }
示例#4
0
 public bool TryGetValue(string path, out IssueTracker tracker)
 {
     return(trackers.TryGetValue(Key(path), out tracker));
 }
示例#5
0
 public void Remove(IssueTracker tracker)
 {
     trackers.Remove(Key(tracker.FilePath));
 }
示例#6
0
 public void Add(IssueTracker tracker)
 {
     trackers.Add(Key(tracker.FilePath), tracker);
 }