Java Code Examples for com.intellij.psi.search.GlobalSearchScope#filesScope()
The following examples show how to use
com.intellij.psi.search.GlobalSearchScope#filesScope() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileInclusionManager.java From BashSupport with Apache License 2.0 | 5 votes |
public static GlobalSearchScope includedFilesUnionScope(PsiFile source) { List<VirtualFile> scopes = Lists.newLinkedList(); scopes.add(source.getVirtualFile()); Set<PsiFile> includedFiles = findIncludedFiles(source, true, true); for (PsiFile file : includedFiles) { scopes.add(file.getVirtualFile()); } return GlobalSearchScope.filesScope(source.getProject(), scopes); }
Example 2
Source File: BashResolveUtil.java From BashSupport with Apache License 2.0 | 5 votes |
public static GlobalSearchScope varDefSearchScope(BashVar reference, boolean withIncludedFiles) { PsiFile referenceFile = BashPsiUtils.findFileContext(reference); if (!withIncludedFiles) { return GlobalSearchScope.fileScope(referenceFile.getProject(), referenceFile.getVirtualFile()); } Set<VirtualFile> result = Sets.newLinkedHashSet(); result.add(referenceFile.getVirtualFile()); int referenceFileOffset = BashPsiUtils.getFileTextOffset(reference); BashFunctionDef referenceFunctionContainer = BashPsiUtils.findNextVarDefFunctionDefScope(reference); for (BashIncludeCommand command : BashPsiUtils.findIncludeCommands(referenceFile, null)) { boolean includeIsInFunction = BashPsiUtils.findNextVarDefFunctionDefScope(command) != null; //either one of var or include command is in a function or the var is used after the include command if (referenceFunctionContainer != null || includeIsInFunction || (referenceFileOffset > BashPsiUtils.getFileTextEndOffset(command))) { BashFileReference fileReference = command.getFileReference(); PsiFile includedFile = fileReference != null ? fileReference.findReferencedFile() : null; if (includedFile != null) { result.add(includedFile.getVirtualFile()); //also, add all files included in the valid include command's file for (PsiFile file : BashPsiUtils.findIncludedFiles(includedFile, true)) { result.add(file.getVirtualFile()); } } } } return GlobalSearchScope.filesScope(referenceFile.getProject(), result); }