Java Code Examples for com.intellij.psi.impl.DebugUtil#performPsiModification()
The following examples show how to use
com.intellij.psi.impl.DebugUtil#performPsiModification() .
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: InjectedLanguageUtil.java From consulo with Apache License 2.0 | 6 votes |
static void clearCaches(@Nonnull PsiFile injected, @Nonnull DocumentWindowImpl documentWindow) { VirtualFileWindowImpl virtualFile = (VirtualFileWindowImpl)injected.getVirtualFile(); PsiManagerEx psiManagerEx = (PsiManagerEx)injected.getManager(); if (psiManagerEx.getProject().isDisposed()) return; DebugUtil.performPsiModification("injected clearCaches", () -> psiManagerEx.getFileManager().setViewProvider(virtualFile, null)); VirtualFile delegate = virtualFile.getDelegate(); if (!delegate.isValid()) return; FileViewProvider viewProvider = psiManagerEx.getFileManager().findCachedViewProvider(delegate); if (viewProvider == null) return; for (PsiFile hostFile : ((AbstractFileViewProvider)viewProvider).getCachedPsiFiles()) { // modification of cachedInjectedDocuments must be under InjectedLanguageManagerImpl.ourInjectionPsiLock synchronized (InjectedLanguageManagerImpl.ourInjectionPsiLock) { List<DocumentWindow> cachedInjectedDocuments = getCachedInjectedDocuments(hostFile); for (int i = cachedInjectedDocuments.size() - 1; i >= 0; i--) { DocumentWindow cachedInjectedDocument = cachedInjectedDocuments.get(i); if (cachedInjectedDocument == documentWindow) { cachedInjectedDocuments.remove(i); } } } } }
Example 2
Source File: SingleRootFileViewProvider.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nullable protected PsiFile getPsiInner(@Nonnull Language target) { if (target != getBaseLanguage()) { return null; } PsiFile psiFile = myPsiFile; if (psiFile == null) { psiFile = createFile(); if (psiFile == null) { psiFile = PsiUtilCore.NULL_PSI_FILE; } boolean set = myPsiFileUpdater.compareAndSet(this, null, psiFile); if (!set && psiFile != PsiUtilCore.NULL_PSI_FILE) { PsiFile alreadyCreated = myPsiFile; if (alreadyCreated == psiFile) { LOG.error(this + ".createFile() must create new file instance but got the same: " + psiFile); } if (psiFile instanceof PsiFileEx) { PsiFile finalPsiFile = psiFile; DebugUtil.performPsiModification("invalidating throw-away copy", () -> ((PsiFileEx)finalPsiFile).markInvalidated()); } psiFile = alreadyCreated; } } return psiFile == PsiUtilCore.NULL_PSI_FILE ? null : psiFile; }
Example 3
Source File: FileTrees.java From consulo with Apache License 2.0 | 5 votes |
FileTrees clearStub(@Nonnull String reason) { StubTree stubHolder = derefStub(); if (stubHolder != null) { ((PsiFileStubImpl<?>)stubHolder.getRoot()).clearPsi(reason); } if (myRefToPsi != null) { DebugUtil.performPsiModification("clearStub", () -> forEachCachedPsi(psi -> { DebugUtil.onInvalidated(psi); psi.setSubstrateRef(SubstrateRef.createInvalidRef(psi)); })); } return new FileTrees(myFile, null, myTreeElementPointer, null); }
Example 4
Source File: PsiVFSListener.java From consulo with Apache License 2.0 | 4 votes |
private void clearViewProvider(@Nonnull VirtualFile vFile, @Nonnull String why) { DebugUtil.performPsiModification(why, () -> myFileManager.setViewProvider(vFile, null)); }