public class CoreInjectedLanguageManager extends InjectedLanguageManager
FRANKENSTEIN_INJECTION, INSTANCE_CACHE
Modifier and Type | Method and Description |
---|---|
void |
dropFileCaches(PsiFile file) |
void |
enumerate(PsiElement host,
PsiLanguageInjectionHost.InjectedPsiVisitor visitor) |
void |
enumerateEx(PsiElement host,
PsiFile containingFile,
boolean probeUp,
PsiLanguageInjectionHost.InjectedPsiVisitor visitor) |
PsiElement |
findInjectedElementAt(PsiFile hostFile,
int hostDocumentOffset)
Finds PSI element in injected fragment (if any) at the given offset in the host file.
E.g.
|
DocumentWindow |
freezeWindow(DocumentWindow document) |
java.util.List<DocumentWindow> |
getCachedInjectedDocumentsInRange(PsiFile hostPsiFile,
TextRange range) |
java.util.List<Pair<PsiElement,TextRange>> |
getInjectedPsiFiles(PsiElement host) |
PsiLanguageInjectionHost |
getInjectionHost(FileViewProvider injectedProvider) |
PsiLanguageInjectionHost |
getInjectionHost(PsiElement injectedElement) |
java.util.List<TextRange> |
getNonEditableFragments(DocumentWindow window) |
PsiFile |
getTopLevelFile(PsiElement element) |
java.lang.String |
getUnescapedText(PsiElement injectedNode) |
int |
injectedToHost(PsiElement injectedContext,
int injectedOffset) |
int |
injectedToHost(PsiElement injectedContext,
int injectedOffset,
boolean minHostOffset) |
TextRange |
injectedToHost(PsiElement injectedContext,
TextRange injectedTextRange) |
java.util.List<TextRange> |
intersectWithAllEditableFragments(PsiFile injectedPsi,
TextRange rangeToEdit) |
boolean |
isInjectedFragment(PsiFile injectedFile) |
boolean |
mightHaveInjectedFragmentAtOffset(Document hostDocument,
int hostOffset)
This method can be invoked on an uncommitted document, before performing commit and using other methods here
(which don't work for uncommitted document).
|
void |
registerMultiHostInjector(MultiHostInjector injector) |
void |
registerMultiHostInjector(MultiHostInjector injector,
Disposable parentDisposable) |
getInstance
public PsiLanguageInjectionHost getInjectionHost(FileViewProvider injectedProvider)
getInjectionHost
in class InjectedLanguageManager
public PsiLanguageInjectionHost getInjectionHost(PsiElement injectedElement)
getInjectionHost
in class InjectedLanguageManager
public TextRange injectedToHost(PsiElement injectedContext, TextRange injectedTextRange)
injectedToHost
in class InjectedLanguageManager
public int injectedToHost(PsiElement injectedContext, int injectedOffset)
injectedToHost
in class InjectedLanguageManager
public int injectedToHost(PsiElement injectedContext, int injectedOffset, boolean minHostOffset)
injectedToHost
in class InjectedLanguageManager
public void registerMultiHostInjector(MultiHostInjector injector)
registerMultiHostInjector
in class InjectedLanguageManager
public void registerMultiHostInjector(MultiHostInjector injector, Disposable parentDisposable)
registerMultiHostInjector
in class InjectedLanguageManager
public java.lang.String getUnescapedText(PsiElement injectedNode)
getUnescapedText
in class InjectedLanguageManager
public java.util.List<TextRange> intersectWithAllEditableFragments(PsiFile injectedPsi, TextRange rangeToEdit)
intersectWithAllEditableFragments
in class InjectedLanguageManager
public boolean isInjectedFragment(PsiFile injectedFile)
isInjectedFragment
in class InjectedLanguageManager
public PsiElement findInjectedElementAt(PsiFile hostFile, int hostDocumentOffset)
InjectedLanguageManager
"<xxx/>"
into Java string literal "String s = "<xxx/>";"
and the caret is at "xxx"
then
this method will return XmlToken(XML_TAG_START) with the text "xxx"
.hostFile
can lead to unexpected results, including throwing an exception!findInjectedElementAt
in class InjectedLanguageManager
public java.util.List<Pair<PsiElement,TextRange>> getInjectedPsiFiles(PsiElement host)
getInjectedPsiFiles
in class InjectedLanguageManager
public void dropFileCaches(PsiFile file)
dropFileCaches
in class InjectedLanguageManager
public PsiFile getTopLevelFile(PsiElement element)
getTopLevelFile
in class InjectedLanguageManager
public java.util.List<DocumentWindow> getCachedInjectedDocumentsInRange(PsiFile hostPsiFile, TextRange range)
getCachedInjectedDocumentsInRange
in class InjectedLanguageManager
public void enumerate(PsiElement host, PsiLanguageInjectionHost.InjectedPsiVisitor visitor)
enumerate
in class InjectedLanguageManager
public void enumerateEx(PsiElement host, PsiFile containingFile, boolean probeUp, PsiLanguageInjectionHost.InjectedPsiVisitor visitor)
enumerateEx
in class InjectedLanguageManager
public java.util.List<TextRange> getNonEditableFragments(DocumentWindow window)
getNonEditableFragments
in class InjectedLanguageManager
public boolean mightHaveInjectedFragmentAtOffset(Document hostDocument, int hostOffset)
InjectedLanguageManager
mightHaveInjectedFragmentAtOffset
in class InjectedLanguageManager
public DocumentWindow freezeWindow(DocumentWindow document)
freezeWindow
in class InjectedLanguageManager