public IEnumerable<MatchingInfo> FindMatchingInfos(IdentifierMatcher matcher, INavigationScope scope, GotoContext gotoContext,
 Func<bool> checkForInterrupt)
   {
       var indices = matcher.MatchingIndicies(matcher.Filter);
         var matchingInfo = new MatchingInfo(matcher.Filter, indices);
         yield return matchingInfo;
   }
        public IEnumerable <IOccurence> GetOccurencesByMatchingInfo(
            [NotNull] MatchingInfo navigationInfo, [NotNull] INavigationScope scope, [NotNull] GotoContext gotoContext, [NotNull] Func <bool> checkForInterrupt)
        {
            var occurrences = gotoContext.GetData(GoToWordOccurrences);

            return(occurrences ?? EmptyList <IOccurence> .InstanceList);
        }
Пример #3
0
        public IEnumerable <MatchingInfo> FindMatchingInfos(IdentifierMatcher matcher, INavigationScope scope, GotoContext gotoContext,
                                                            Func <bool> checkForInterrupt)
        {
            var indices      = matcher.MatchingIndicies(matcher.Filter);
            var matchingInfo = new MatchingInfo(matcher.Filter, indices);

            yield return(matchingInfo);
        }
Пример #4
0
 public IEnumerable <IOccurrence> GetOccurrencesByMatchingInfo(
     MatchingInfo navigationInfo,
     INavigationScope scope,
     GotoContext gotoContext,
     Func <bool> checkForInterrupt)
 {
     yield break;
 }
   public IEnumerable<IOccurence> GetOccurencesByMatchingInfo(MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext,
 Func<bool> checkForInterrupt)
   {
       // send this off to the server to be processed
         foreach (string s in yt.GetCompletionOptionsFor(navigationInfo.Identifier))
         {
       yield return new YouTrackIssueOccurence {IssueId = navigationInfo.Identifier, IssueDescription = s};
         }
   }
Пример #6
0
 public IEnumerable <IOccurence> GetOccurencesByMatchingInfo(MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext,
                                                             Func <bool> checkForInterrupt)
 {
     // send this off to the server to be processed
     foreach (string s in yt.GetCompletionOptionsFor(navigationInfo.Identifier))
     {
         yield return(new YouTrackIssueOccurence {
             IssueId = navigationInfo.Identifier, IssueDescription = s
         });
     }
 }
Пример #7
0
    public List <MatchingInfo> verticalMatches()
    {
        List <MatchingInfo> result = new List <MatchingInfo>();

        for (int col = 0; col < size; col++)
        {
            List <MatchingInfo> matches = new List <MatchingInfo>();
            for (int row = 0; row < size; row++)
            {
                MatchingInfo match      = new MatchingInfo();
                int          startindex = row;
                int          endindex   = row;
                string       matchType  = grid [col, row].type;

                for (int tmprow = row + 1; tmprow < size; tmprow++)
                {
                    if (grid[col, tmprow].type == matchType)
                    {
                        endindex = tmprow;
                    }
                    else
                    {
                        row = tmprow - 1;
                        break;
                    }
                }

                int len = 1 + endindex - startindex;
                if (len >= matchingSize)
                {
                    match.lineLength = len;
                    match.type       = matchType;
                    List <Vector2> retval = new List <Vector2>();
                    for (int start = startindex; start <= endindex; start++)
                    {
                        retval.Add(new Vector2(col, start));
                    }
                    match.matchedItems = retval;
                    matches.Add(match);
                }
            }
            result.AddRange(matches);
        }

        return(result);
    }
Пример #8
0
        public IEnumerable <IOccurence> GetOccurencesByMatchingInfo(MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext)
        {
            var fileMembersMap = gotoContext.GetData(ClrFileMembersMap.ClrFileMembersMapKey);

            if (fileMembersMap == null)
            {
                yield break;
            }

            var membersData = fileMembersMap[navigationInfo.Identifier];

            foreach (var clrFileMemberData in membersData)
            {
                var occurence = CreateOccurence(clrFileMemberData);
                if (occurence != null)
                {
                    yield return(occurence);
                }
            }
        }
    /// <summary>
    /// Finds matched items and returns a corresponing list of matchingInfos.
    ///             Controller (or some other entity that will use this provider) recieves these items, scores them, sorts 
    ///             and than invoke GetOccurences for the top scored of them.
    /// </summary>
    /// <param name="matcher">matcher to use</param><param name="scope">defines a scope to search in</param><param name="gotoContext"/><param name="checkForInterrupt"/>
    /// <returns/>
    public IEnumerable<MatchingInfo> FindMatchingInfos(IdentifierMatcher matcher, INavigationScope scope, GotoContext gotoContext, Func<bool> checkForInterrupt)
    {
      var occurrences = new List<ItemOccurence>();

      var databases = new List<DatabaseUri>();
      foreach (var project in VisualStudio.Projects.ProjectManager.Projects)
      {
        if (project.Site != null)
        {
          databases.Add(new DatabaseUri(project.Site, DatabaseName.Master));
        }
      }

      using (var fibers = this.myTaskHost.CreateBarrier(this.myLifetime, checkForInterrupt, false, false))
      {
        foreach (var databaseUri in databases)
        {
          var busy = true;
          var db = databaseUri;

          ExecuteCompleted completed = delegate(string response, ExecuteResult executeResult)
          {
            if (!DataService.HandleExecute(response, executeResult, true))
            {
              busy = false;
              return;
            }

            var r = response.ToXElement();
            if (r == null)
            {
              busy = false;
              return;
            }

            foreach (var element in r.Elements())
            {
              occurrences.Add(new ItemOccurence(ItemHeader.Parse(db, element)));
            }

            busy = false;
          };

          databaseUri.Site.DataService.ExecuteAsync("Search.Search", completed, matcher.Filter, string.Empty, string.Empty, string.Empty, string.Empty, 0);
          AppHost.DoEvents(ref busy);
        }
      }

      gotoContext.PutData(SitecoreItemOccurrences, occurrences);

      var matchingInfo = new MatchingInfo(matcher.Filter, EmptyList<IdentifierMatch>.InstanceList);
      return new[] { matchingInfo };
    }
    /// <summar>Gets occurences by given matchingInfo </summar><param name="navigationInfo"/><param name="scope"/><param name="gotoContext"/><param name="checkForInterrupt"/>
    /// <returns/>
    public IEnumerable<IOccurence> GetOccurencesByMatchingInfo(MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext, Func<bool> checkForInterrupt)
    {
      var occurrences = gotoContext.GetData(SitecoreItemOccurrences);

      return occurrences ?? EmptyList<ItemOccurence>.InstanceList;
    }
        public IEnumerable <IOccurence> GetOccurencesByMatchingInfo(
            MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext, Func <bool> checkCancelled)
        {
            var fileMembersMap = gotoContext.GetData(NTriplesFileMembersMap.NTriplesFileMembersMapKey);

            if (fileMembersMap == null)
            {
                yield break;
            }

            var membersData = fileMembersMap[navigationInfo.Identifier];

            foreach (var clrFileMemberData in membersData)
            {
                var occurence = this.CreateOccurence(clrFileMemberData);
                if (occurence != null)
                {
                    yield return(occurence);
                }
            }

            /*
             *
             * ISolution solution = scope.GetSolution();
             * var cache = this.GetCache(scope, solution, gotoContext);
             * var namespaceNavigationScope = scope as NamespaceNavigationScope;
             * if (namespaceNavigationScope != null)
             * {
             *  INamespace namespaceScope = namespaceNavigationScope.DeclaredElement as INamespace;
             *  if (namespaceScope != null)
             *  {
             *      return (IEnumerable<IOccurence>)EmptyList<IOccurence>.InstanceList;
             *  }
             *  //return Enumerable.Select<IClrDeclaredElement, IOccurence>(Enumerable.Where<IClrDeclaredElement>(Enumerable.Where<IClrDeclaredElement>(ChainedScopesUtil.GetAllSubElements(namespaceScope, cache, true), (Func<IClrDeclaredElement, bool>)(element => element.ShortName == navigationInfo.Identifier)), new Func<IClrDeclaredElement, bool>(this.IsDeclaredElementVisible)), (Func<IClrDeclaredElement, IOccurence>)(x => (IOccurence)new ChainedCodeModelOccurence((IDeclaredElement)x, navigationInfo, OccurencePresentationOptions.DefaultOptions)));
             * }
             * if (!(scope is SolutionNavigationScope))
             * {
             *  return (IEnumerable<IOccurence>)EmptyList<IOccurence>.InstanceList;
             * }
             * List<IClrDeclaredElement> list1 = new List<IClrDeclaredElement>();
             * foreach (ITypeMember typeMember in cache.GetSourceMembers(navigationInfo.Identifier))
             * {
             *  if (!typeMember.IsSynthetic() && !(typeMember is IAccessor))
             *  {
             *      list1.Add((IClrDeclaredElement)typeMember);
             *  }
             * }
             * List<IClrDeclaredElement> list2 = new List<IClrDeclaredElement>();
             * if (scope.ExtendedSearchFlag == LibrariesFlag.SolutionAndLibraries)
             * {
             *  foreach (ITypeMember typeMember in cache.GetCompiledMembers(navigationInfo.Identifier))
             *  {
             *      list2.Add((IClrDeclaredElement)typeMember);
             *  }
             * }
             * IClrDeclaredElement[] elementsByShortName = cache.GetElementsByShortName(navigationInfo.Identifier);
             * return
             *  Enumerable.Select<IClrDeclaredElement, IOccurence>(
             *      Enumerable.Where<IClrDeclaredElement>(
             *          Enumerable.Concat<IClrDeclaredElement>(
             *              CollectionUtil.Concat<IClrDeclaredElement>(
             *                  (IEnumerable<IClrDeclaredElement>)list1, elementsByShortName),
             *              (IEnumerable<IClrDeclaredElement>)list2),
             *          new Func<IClrDeclaredElement, bool>(this.IsDeclaredElementVisible)),
             *      (Func<IClrDeclaredElement, IOccurence>)
             *      (x => (IOccurence)new DeclaredElementOccurence((IDeclaredElement)x, OccurenceType.Occurence)));*/
        }
        public IEnumerable<IOccurence> GetOccurencesByMatchingInfo(
            MatchingInfo navigationInfo,
            INavigationScope scope,
            GotoContext gotoContext,
            Func<bool> checkForInterrupt)
        {
            var fileMembersMap = gotoContext.GetData(NTriplesFileMembersMap.NTriplesFileMembersMapKey);
            if (fileMembersMap == null)
            {
                yield break;
            }

            var membersData = fileMembersMap[navigationInfo.Identifier];
            foreach (var clrFileMemberData in membersData)
            {
                var occurence = this.CreateOccurence(clrFileMemberData);
                if (occurence != null)
                {
                    yield return occurence;
                }
            }
        }
        public IEnumerable<IOccurence> GetOccurencesByMatchingInfo(
            MatchingInfo navigationInfo, INavigationScope scope, GotoContext gotoContext, Func<bool> checkCancelled)
        {
            var fileMembersMap = gotoContext.GetData(NTriplesFileMembersMap.NTriplesFileMembersMapKey);
            if (fileMembersMap == null)
            {
                yield break;
            }

            var membersData = fileMembersMap[navigationInfo.Identifier];
            foreach (var clrFileMemberData in membersData)
            {
                var occurence = this.CreateOccurence(clrFileMemberData);
                if (occurence != null)
                {
                    yield return occurence;
                }
            }
            /*

            ISolution solution = scope.GetSolution();
            var cache = this.GetCache(scope, solution, gotoContext);
            var namespaceNavigationScope = scope as NamespaceNavigationScope;
            if (namespaceNavigationScope != null)
            {
                INamespace namespaceScope = namespaceNavigationScope.DeclaredElement as INamespace;
                if (namespaceScope != null)
                {
                    return (IEnumerable<IOccurence>)EmptyList<IOccurence>.InstanceList;
                }
                //return Enumerable.Select<IClrDeclaredElement, IOccurence>(Enumerable.Where<IClrDeclaredElement>(Enumerable.Where<IClrDeclaredElement>(ChainedScopesUtil.GetAllSubElements(namespaceScope, cache, true), (Func<IClrDeclaredElement, bool>)(element => element.ShortName == navigationInfo.Identifier)), new Func<IClrDeclaredElement, bool>(this.IsDeclaredElementVisible)), (Func<IClrDeclaredElement, IOccurence>)(x => (IOccurence)new ChainedCodeModelOccurence((IDeclaredElement)x, navigationInfo, OccurencePresentationOptions.DefaultOptions)));
            }
            if (!(scope is SolutionNavigationScope))
            {
                return (IEnumerable<IOccurence>)EmptyList<IOccurence>.InstanceList;
            }
            List<IClrDeclaredElement> list1 = new List<IClrDeclaredElement>();
            foreach (ITypeMember typeMember in cache.GetSourceMembers(navigationInfo.Identifier))
            {
                if (!typeMember.IsSynthetic() && !(typeMember is IAccessor))
                {
                    list1.Add((IClrDeclaredElement)typeMember);
                }
            }
            List<IClrDeclaredElement> list2 = new List<IClrDeclaredElement>();
            if (scope.ExtendedSearchFlag == LibrariesFlag.SolutionAndLibraries)
            {
                foreach (ITypeMember typeMember in cache.GetCompiledMembers(navigationInfo.Identifier))
                {
                    list2.Add((IClrDeclaredElement)typeMember);
                }
            }
            IClrDeclaredElement[] elementsByShortName = cache.GetElementsByShortName(navigationInfo.Identifier);
            return
                Enumerable.Select<IClrDeclaredElement, IOccurence>(
                    Enumerable.Where<IClrDeclaredElement>(
                        Enumerable.Concat<IClrDeclaredElement>(
                            CollectionUtil.Concat<IClrDeclaredElement>(
                                (IEnumerable<IClrDeclaredElement>)list1, elementsByShortName),
                            (IEnumerable<IClrDeclaredElement>)list2),
                        new Func<IClrDeclaredElement, bool>(this.IsDeclaredElementVisible)),
                    (Func<IClrDeclaredElement, IOccurence>)
                    (x => (IOccurence)new DeclaredElementOccurence((IDeclaredElement)x, OccurenceType.Occurence)));*/
        }