public class InjectedLanguageManagerImpl extends InjectedLanguageManager implements Disposable
Disposable.Parent
FRANKENSTEIN_INJECTION, INSTANCE_CACHE
Constructor and Description |
---|
InjectedLanguageManagerImpl(Project project) |
Modifier and Type | Method and Description |
---|---|
static void |
checkInjectorsAreDisposed(Project project) |
void |
dispose()
Usually not invoked directly, see class javadoc.
|
static void |
disposeInvalidEditors() |
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) |
static InjectedLanguageManagerImpl |
getInstanceImpl(Project project) |
java.util.List<TextRange> |
getNonEditableFragments(DocumentWindow window) |
PsiFile |
getTopLevelFile(PsiElement element) |
java.lang.String |
getUnescapedText(PsiElement injectedNode) |
int |
injectedToHost(PsiElement element,
int offset) |
int |
injectedToHost(PsiElement injectedContext,
int injectedOffset,
boolean minHostOffset) |
TextRange |
injectedToHost(PsiElement injectedContext,
TextRange injectedTextRange) |
java.util.List<TextRange> |
intersectWithAllEditableFragments(PsiFile injectedPsi,
TextRange rangeToEdit)
intersection may spread over several injected fragments
|
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 |
processInjectableElements(java.util.Collection<? extends PsiElement> in,
Processor<? super PsiElement> processor) |
static void |
pushInjectors(Project project) |
void |
registerMultiHostInjector(MultiHostInjector injector) |
void |
registerMultiHostInjector(MultiHostInjector injector,
Disposable parentDisposable) |
getInstance
public InjectedLanguageManagerImpl(Project project)
public static InjectedLanguageManagerImpl getInstanceImpl(Project project)
public void dispose()
Disposable
dispose
in interface Disposable
public static void disposeInvalidEditors()
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 element, int offset)
injectedToHost
in class InjectedLanguageManager
public int injectedToHost(PsiElement injectedContext, int injectedOffset, boolean minHostOffset)
injectedToHost
in class InjectedLanguageManager
public void processInjectableElements(java.util.Collection<? extends PsiElement> in, Processor<? super PsiElement> processor)
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
rangeToEdit
- range in encoded(raw) PSIpublic 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 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
public static void pushInjectors(Project project)
public static void checkInjectorsAreDisposed(Project project)
public java.util.List<Pair<PsiElement,TextRange>> getInjectedPsiFiles(PsiElement host)
getInjectedPsiFiles
in class InjectedLanguageManager