private void FindByWords( [NotNull] string textToSearch, [NotNull] ISolution solution, [NotNull] List <IOccurence> occurrences, [NotNull] UserDataHolder gotoContext, [NotNull] Func <bool> checkCanceled) { var wordIndex = solution.GetPsiServices().WordIndex; var longestWord = wordIndex.GetWords(textToSearch).OrderByDescending(word => word.Length).FirstOrDefault(); if (gotoContext.GetData(GoToWordFirstTimeLookup) == null) { // force word index to process all not processed files if (PrepareWordIndex(solution, wordIndex, checkCanceled)) { gotoContext.PutData(GoToWordFirstTimeLookup, GoToWordFirstTimeLookup); } } if (longestWord == null) { return; } var sourceFiles = new HashSet <IPsiSourceFile>(); sourceFiles.AddRange(wordIndex.GetFilesContainingWord(longestWord)); sourceFiles.AddRange(wordIndex.GetFilesContainingWord(textToSearch)); foreach (var sourceFile in sourceFiles) { if (IsFilteredFile(sourceFile)) { continue; } SearchInFile(textToSearch, sourceFile, occurrences, checkCanceled); } }
public T GetData <T>(Key <T> key) where T : class => _userDataHolder.GetData(key);