Exemple #1
0
        private void CreateEntries(DirectoryEntry searchResults)
        {
            if (!_enabled)
            {
                return;
            }

            using (new TimeElapsedLogger("Creating document tracking entries for search results", InfoLogger.Instance)) {
                _searchResults.Clear();
                foreach (DirectoryEntry projectRoot in searchResults.Entries)
                {
                    var rootPath = new FullPath(projectRoot.Name);
                    foreach (FileEntry fileEntry in projectRoot.Entries)
                    {
                        var path  = rootPath.Combine(new RelativePath(fileEntry.Name));
                        var spans = fileEntry.Data as FilePositionsData;
                        if (spans != null)
                        {
                            _searchResults[path] = spans;

                            // If the document is open, create the tracking spans now.
                            var document = _textDocumentTable.GetOpenDocument(path);
                            if (document != null)
                            {
                                var entry = new DocumentChangeTrackingEntry(spans);
                                _trackingEntries[path] = entry;
                                entry.CreateTrackingSpans(document.TextBuffer);
                            }
                        }
                    }
                }
            }
        }
    private void CreateEntries(DirectoryEntry searchResults) {
      if (!_enabled)
        return;

      using (new TimeElapsedLogger("Creating document tracking entries for search results")) {
        _searchResults.Clear();
        foreach (DirectoryEntry projectRoot in searchResults.Entries) {
          var rootPath = new FullPath(projectRoot.Name);
          foreach (FileEntry fileEntry in projectRoot.Entries) {
            var path = rootPath.Combine(new RelativePath(fileEntry.Name));
            var spans = fileEntry.Data as FilePositionsData;
            if (spans != null) {
              _searchResults[path] = spans;

              // If the document is open, create the tracking spans now.
              var document = _textDocumentTable.GetOpenDocument(path);
              if (document != null) {
                var entry = new DocumentChangeTrackingEntry(spans);
                _trackingEntries[path] = entry;
                entry.CreateTrackingSpans(document.TextBuffer);
              }
            }
          }
        }
      }
    }
Exemple #3
0
        public void DocumentOpen(ITextDocument document, EventArgs args)
        {
            if (!_enabled)
            {
                return;
            }
            if (!FullPath.IsValid(document.FilePath))
            {
                return;
            }
            var path = new FullPath(document.FilePath);

            // Lookup or create the tracking entry for this document
            var entry = _trackingEntries.GetValue(path);

            if (entry == null)
            {
                // Create entry if it Is the path part of the search results
                var spans = _searchResults.GetValue(path);
                if (spans != null)
                {
                    entry = new DocumentChangeTrackingEntry(spans);
                    _trackingEntries[path] = entry;
                }
            }

            // Create the tracking spans.
            if (entry != null)
            {
                entry.CreateTrackingSpans(document.TextBuffer);
            }
        }
    public void DocumentOpen(ITextDocument document, EventArgs args) {
      if (!_enabled)
        return;
      if (!FullPath.IsValid(document.FilePath))
        return;
      var path = new FullPath(document.FilePath);

      // Lookup or create the tracking entry for this document
      var entry = _trackingEntries.GetValue(path);
      if (entry == null) {
        // Create entry if it Is the path part of the search results
        var spans = _searchResults.GetValue(path);
        if (spans != null) {
          entry = new DocumentChangeTrackingEntry(spans);
          _trackingEntries[path] = entry;
        }
      }

      // Create the tracking spans.
      if (entry != null) {
        entry.CreateTrackingSpans(document.TextBuffer);
      }
    }