public abstract class InjectedLanguageManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Key<java.lang.Boolean> |
FRANKENSTEIN_INJECTION |
protected static NotNullLazyKey<InjectedLanguageManager,Project> |
INSTANCE_CACHE |
Constructor and Description |
---|
InjectedLanguageManager() |
Modifier and Type | Method and Description |
---|---|
abstract void |
dropFileCaches(PsiFile file) |
abstract void |
enumerate(PsiElement host,
PsiLanguageInjectionHost.InjectedPsiVisitor visitor) |
abstract void |
enumerateEx(PsiElement host,
PsiFile containingFile,
boolean probeUp,
PsiLanguageInjectionHost.InjectedPsiVisitor visitor) |
abstract PsiElement |
findInjectedElementAt(PsiFile hostFile,
int hostDocumentOffset)
Finds PSI element in injected fragment (if any) at the given offset in the host file.
E.g.
|
abstract DocumentWindow |
freezeWindow(DocumentWindow document) |
abstract java.util.List<DocumentWindow> |
getCachedInjectedDocumentsInRange(PsiFile hostPsiFile,
TextRange range) |
abstract java.util.List<Pair<PsiElement,TextRange>> |
getInjectedPsiFiles(PsiElement host) |
abstract PsiLanguageInjectionHost |
getInjectionHost(FileViewProvider injectedProvider) |
abstract PsiLanguageInjectionHost |
getInjectionHost(PsiElement injectedElement) |
static InjectedLanguageManager |
getInstance(Project project) |
abstract java.util.List<TextRange> |
getNonEditableFragments(DocumentWindow window) |
abstract PsiFile |
getTopLevelFile(PsiElement element) |
abstract java.lang.String |
getUnescapedText(PsiElement injectedNode) |
abstract int |
injectedToHost(PsiElement injectedContext,
int injectedOffset) |
abstract int |
injectedToHost(PsiElement injectedContext,
int injectedOffset,
boolean minHostOffset) |
abstract TextRange |
injectedToHost(PsiElement injectedContext,
TextRange injectedTextRange) |
abstract java.util.List<TextRange> |
intersectWithAllEditableFragments(PsiFile injectedPsi,
TextRange rangeToEdit) |
abstract boolean |
isInjectedFragment(PsiFile injectedFile) |
abstract 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).
|
abstract void |
registerMultiHostInjector(MultiHostInjector injector)
Deprecated.
use
extension point for production and
registerMultiHostInjector(MultiHostInjector, Disposable) for tests |
abstract void |
registerMultiHostInjector(MultiHostInjector injector,
Disposable parentDisposable) |
protected static final NotNullLazyKey<InjectedLanguageManager,Project> INSTANCE_CACHE
public static final Key<java.lang.Boolean> FRANKENSTEIN_INJECTION
public static InjectedLanguageManager getInstance(Project project)
public abstract PsiLanguageInjectionHost getInjectionHost(FileViewProvider injectedProvider)
public abstract PsiLanguageInjectionHost getInjectionHost(PsiElement injectedElement)
public abstract TextRange injectedToHost(PsiElement injectedContext, TextRange injectedTextRange)
public abstract int injectedToHost(PsiElement injectedContext, int injectedOffset)
public abstract int injectedToHost(PsiElement injectedContext, int injectedOffset, boolean minHostOffset)
@Deprecated public abstract void registerMultiHostInjector(MultiHostInjector injector)
extension point
for production and
registerMultiHostInjector(MultiHostInjector, Disposable)
for testspublic abstract void registerMultiHostInjector(MultiHostInjector injector, Disposable parentDisposable)
public abstract java.lang.String getUnescapedText(PsiElement injectedNode)
public abstract java.util.List<TextRange> intersectWithAllEditableFragments(PsiFile injectedPsi, TextRange rangeToEdit)
public abstract boolean isInjectedFragment(PsiFile injectedFile)
public abstract PsiElement findInjectedElementAt(PsiFile hostFile, int hostDocumentOffset)
"<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!public abstract java.util.List<Pair<PsiElement,TextRange>> getInjectedPsiFiles(PsiElement host)
public abstract void dropFileCaches(PsiFile file)
public abstract PsiFile getTopLevelFile(PsiElement element)
public abstract java.util.List<DocumentWindow> getCachedInjectedDocumentsInRange(PsiFile hostPsiFile, TextRange range)
public abstract void enumerate(PsiElement host, PsiLanguageInjectionHost.InjectedPsiVisitor visitor)
public abstract void enumerateEx(PsiElement host, PsiFile containingFile, boolean probeUp, PsiLanguageInjectionHost.InjectedPsiVisitor visitor)
public abstract java.util.List<TextRange> getNonEditableFragments(DocumentWindow window)
public abstract boolean mightHaveInjectedFragmentAtOffset(Document hostDocument, int hostOffset)
public abstract DocumentWindow freezeWindow(DocumentWindow document)