private ISearchDomain NarrowSearchDomain(ISolution solution, IEnumerable <string> words, IEnumerable <string> extendedWords, ISearchDomain domain) { List <string> allWords = words.ToList(); List <string> allExtendedWords = extendedWords.ToList(); if (domain.IsEmpty || allWords.IsEmpty()) { return(domain); } IWordIndex wordIndex = solution.GetPsiServices().CacheManager.WordIndex; var jetHashSet1 = new JetHashSet <IPsiSourceFile>(wordIndex.GetFilesContainingWord(allWords.First()), null); foreach (string word in allWords.Skip(1)) { jetHashSet1.IntersectWith(wordIndex.GetFilesContainingWord(word)); } if (allExtendedWords.Any()) { var jetHashSet2 = new JetHashSet <IPsiSourceFile>(null); using (JetHashSet <IPsiSourceFile> .ElementEnumerator enumerator = jetHashSet1.GetEnumerator()) { while (enumerator.MoveNext()) { IPsiSourceFile file = enumerator.Current; if (allExtendedWords.Any(word => wordIndex.CanContainWord(file, word))) { jetHashSet2.Add(file); } } } jetHashSet1 = jetHashSet2; } return(domain.Intersect(searchDomainFactory.CreateSearchDomain(jetHashSet1))); }
public SolutionAnalyzer([NotNull] PatternSearcher patternSearcher, [NotNull] SearchDomainFactory searchDomainFactory, [NotNull] IWordIndex wordIndex) { this.patternSearcher = patternSearcher; this.searchDomainFactory = searchDomainFactory; this.wordIndex = wordIndex; LoadContainerInfos(); }
public SolutionAnalyzer(PatternSearcher patternSearcher, SearchDomainFactory searchDomainFactory, IWordIndex wordIndex) { this.patternSearcher = patternSearcher; this.searchDomainFactory = searchDomainFactory; this.wordIndex = wordIndex; LoadContainerInfos(); }
public NitraReferenceSearcher(NitraSearcherFactory factory, IEnumerable <IDeclaredElement> elements, bool findCandidates, bool searchForLateBound) { myFindCandidates = findCandidates; mySearchForLateBound = searchForLateBound; myElements = new JetHashSet <IDeclaredElement>(elements); myNames = new JetHashSet <string>(); myWordsInText = new JetHashSet <string>(); foreach (var element in myElements) { myNames.Add(element.ShortName); myWordsInText.UnionWith(factory.GetAllPossibleWordsInFile(element)); } myWordIndex = myElements.First().GetPsiServices().WordIndex; }
private bool PrepareWordIndex( [NotNull] ISolution solution, [NotNull] IWordIndex wordIndex, [NotNull] CheckForInterrupt checkCanceled) { var persistentIndexManager = solution.GetComponent <IPersistentIndexManager>(); #if RESHARPER8 using (var pool = new MultiCoreFibersPool(GoToWordPoolName, myShellLocks, myConfigurations)) using (var fibers = pool.Create("Updating word index cache")) #elif RESHARPER81 || RESHARPER9 using (var fibers = myTaskHost.CreateBarrier( myLifetime, checkCanceled, sync: false, takeReadLock: false)) #endif { var wordCache = (ICache)wordIndex; foreach (var psiSourceFile in GetAllSolutionFiles(solution)) { // workaround WordIndex2 implementation, to force indexing // unknown project file types like *.txt files and other var fileToCheck = psiSourceFile.Properties.ShouldBuildPsi ? psiSourceFile : new SourceFileToBuildCache(psiSourceFile); if (!wordCache.UpToDate(fileToCheck)) { var sourceFile = psiSourceFile; fibers.EnqueueJob(() => { using (ReadLockCookie.Create()) { var data = wordCache.Build(sourceFile, false); wordCache.Merge(sourceFile, data); persistentIndexManager.OnPersistentCachesUpdated(sourceFile); } }); } if (checkCanceled()) { return(false); } } } return(true); }
private bool PrepareWordIndex([NotNull] ISolution solution, [NotNull] IWordIndex wordIndex, [NotNull] Func <bool> checkCanceled) { var persistentIndexManager = solution.GetComponent <IPersistentIndexManager>(); using (var fibers = myTaskHost.CreateBarrier( myLifetime, checkCanceled, sync: false, takeReadLock: false)) { var wordCache = (ICache)wordIndex; foreach (var psiSourceFile in GetAllSolutionFiles(solution)) { // workaround WordIndex2 implementation, to force indexing // unknown project file types like *.txt files and other var fileToCheck = psiSourceFile.Properties.ShouldBuildPsi ? psiSourceFile : new SourceFileToBuildCache(psiSourceFile); if (!wordCache.UpToDate(fileToCheck)) { var sourceFile = psiSourceFile; fibers.EnqueueJob(() => { using (ReadLockCookie.Create()) { var data = wordCache.Build(sourceFile, false); wordCache.Merge(sourceFile, data); //persistentIndexManager.OnPersistentCachesUpdated(sourceFile); } }); } if (checkCanceled()) { return(false); } } } return(true); }
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks) { if (sourceFile.PrimaryPsiLanguage.Is <YamlLanguage>() && sourceFile.IsAsset()) { if (wordIndexForChecks == null || (wordIndexForChecks.CanContainAllSubwords(sourceFile, "m_Script") && wordIndexForChecks.CanContainAllSubwords(sourceFile, "11500000"))) { return(new MonoScriptReferenceFactory()); } } return(null); }
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks) { var project = sourceFile.GetProject(); if (project == null || !project.IsUnityProject()) { return(null); } if (sourceFile.PrimaryPsiLanguage.Is <CSharpLanguage>()) { return(new UnityEventFunctionReferenceFactory(myPredefinedTypeCache)); } return(null); }
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks) { var project = sourceFile.GetProject(); if (project == null || !project.IsUnityProject()) { return(null); } if (sourceFile.PrimaryPsiLanguage.Is <CSharpLanguage>()) { return(new SyncVarHookReferenceFactory()); } return(null); }
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks) { var project = sourceFile.GetProject(); if (project == null || !project.IsUnityProject()) { return(null); } if (sourceFile.IsAsmDef() && sourceFile.PrimaryPsiLanguage.Is <JsonLanguage>()) { return(new AsmDefNameReferenceFactory()); } return(null); }
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks) => sourceFile.PrimaryPsiLanguage.Is <T4Language>() ? new T4ReferenceFactory(IncludeResolver) : null;
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks) { return(sourceFile.PrimaryPsiLanguage.Is <SpringLanguage>() ? new SpringReferenceFactory() : null); }
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks) { if (sourceFile.PrimaryPsiLanguage is SpringLanguage) { return(new HaskellReferenceFactory()); } return(null); }
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks) { if (sourceFile.PrimaryPsiLanguage.Is <YamlLanguage>() && sourceFile.IsAsset()) { if (wordIndexForChecks == null || wordIndexForChecks.CanContainAllSubwords(sourceFile, "m_MethodName")) { return(new UnityEventTargetReferenceFactory()); } } return(null); }
public IReferenceFactory CreateFactory(IPsiSourceFile sourceFile, IFile file, IWordIndex wordIndexForChecks) { if (sourceFile.PrimaryPsiLanguage.Is <CSharpLanguage>()) { return(new CSharpToGherkinReferenceFactory()); } return(null); }
internal LuceneWordSuggester(IWordIndex index) { this.index = index; }