public interface FileViewProvider extends java.lang.Cloneable, UserDataHolderEx
FileViewProviderFactory
.
Please see File View Providers
for high-level overview.Modifier and Type | Method and Description |
---|---|
void |
beforeContentsSynchronized()
Invoked before document or VFS changes are processed that affect PSI inside the corresponding file.
|
FileViewProvider |
clone() |
void |
contentsSynchronized()
Invoked after PSI in the corresponding file is synchronized with the corresponding document, which can happen
after VFS, document or PSI changes.
|
FileViewProvider |
createCopy(VirtualFile copy)
Creates a copy of this view provider linked with the given (typically light) file.
|
PsiElement |
findElementAt(int offset) |
PsiElement |
findElementAt(int offset,
java.lang.Class<? extends Language> lang) |
PsiElement |
findElementAt(int offset,
Language language) |
PsiReference |
findReferenceAt(int offset) |
PsiReference |
findReferenceAt(int offset,
Language language) |
java.util.List<PsiFile> |
getAllFiles() |
Language |
getBaseLanguage() |
java.lang.CharSequence |
getContents() |
Document |
getDocument() |
FileType |
getFileType() |
java.util.Set<Language> |
getLanguages() |
PsiManager |
getManager() |
long |
getModificationStamp() |
PsiFile |
getPsi(Language target) |
PsiFile |
getStubBindingRoot() |
VirtualFile |
getVirtualFile() |
default boolean |
hasLanguage(Language language)
Check if given language is supported.
|
boolean |
isEventSystemEnabled() |
boolean |
isPhysical() |
void |
rootChanged(PsiFile psiFile)
Invoked when any PSI change happens in any of the PSI files corresponding to this view provider.
|
boolean |
supportsIncrementalReparse(Language rootLanguage) |
putUserDataIfAbsent, replace
getUserData, putUserData
PsiManager getManager()
Document getDocument()
null
for binary or files without events enabled.FileType.isBinary()
,
PsiBinaryFile
,
isEventSystemEnabled()
java.lang.CharSequence getContents()
PsiDocumentManager.getLastCommittedText(Document)
.getDocument()
,
PsiDocumentManager.isUncommited(Document)
VirtualFile getVirtualFile()
LightVirtualFile
for most non-physical files.Language getBaseLanguage()
PsiManager.findFile(VirtualFile)
,
PsiDocumentManager.getPsiFile(Document)
etc.java.util.Set<Language> getLanguages()
getPsi(Language)
default boolean hasLanguage(Language language)
PsiFile getPsi(Language target)
null
if the language is not presentjava.util.List<PsiFile> getAllFiles()
getLanguages()
. The main file which corresponds to getBaseLanguage()
, should be the first one. Otherwise
the order is non-deterministic and should not be relied upon.boolean isEventSystemEnabled()
true
for physical files and for some non-physical as well.PsiTreeChangeListener
,
PsiFileFactory.createFileFromText(String, FileType, CharSequence, long, boolean)
,
PsiElement.isPhysical()
boolean isPhysical()
PsiFile.getVirtualFile()
returns non-null.
Not to be confused with PsiElement.isPhysical()
which (for historical reasons) returns getViewProvider().isEventSystemEnabled()
isEventSystemEnabled()
,
PsiElement.isPhysical()
long getModificationStamp()
VirtualFile
or Document
.
If a document is modified but not yet committed, the result is the same as PsiDocumentManager.getLastCommittedStamp(Document)
VirtualFile.getModificationStamp()
,
Document.getModificationStamp()
boolean supportsIncrementalReparse(Language rootLanguage)
getLanguages()
void rootChanged(PsiFile psiFile)
psiFile
- the file where PSI has just been changed.void beforeContentsSynchronized()
void contentsSynchronized()
Multi-language file view providers may override this method to recalculate template data languages.
getLanguages()
FileViewProvider clone()
LightVirtualFile
, not physical and with PSI events disabled.isPhysical()
,
isEventSystemEnabled()
,
createCopy(VirtualFile)
PsiElement findElementAt(int offset)
getBaseLanguage()
,
findElementAt(int, Class)
,
findElementAt(int, Language)
,
PsiElement.findElementAt(int)
PsiReference findReferenceAt(int offset)
getBaseLanguage()
,
PsiElement.findReferenceAt(int)
,
findReferenceAt(int, Language)
PsiElement findElementAt(int offset, Language language)
getBaseLanguage()
,
findElementAt(int)
PsiElement findElementAt(int offset, java.lang.Class<? extends Language> lang)
getBaseLanguage()
,
findElementAt(int)
PsiReference findReferenceAt(int offset, Language language)
getBaseLanguage()
,
PsiElement.findReferenceAt(int)
,
findReferenceAt(int)
FileViewProvider createCopy(VirtualFile copy)
LightVirtualFile
,
isEventSystemEnabled()
PsiFile getStubBindingRoot()
getBaseLanguage()
FileType getFileType()
getVirtualFile().getFileType()
, but cached.