[lang-api] Disable code insight actions for compiled files

Fixes IDEA-289020 Action "Insert live template" should not be available inside read-only files

GitOrigin-RevId: fda198a7766c5b9a99ec411f522e225ac96f0cdf
This commit is contained in:
Tagir Valeev
2022-02-25 11:10:28 +00:00
committed by intellij-monorepo-bot
parent 30a7e001ee
commit e9a60bebf9
@@ -12,6 +12,7 @@ import com.intellij.openapi.editor.EditorModificationUtil;
import com.intellij.openapi.editor.actionSystem.DocCommandGroupId;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsContexts;
import com.intellij.psi.PsiCompiledElement;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiUtilBase;
@@ -51,6 +52,9 @@ public abstract class CodeInsightAction extends AnAction implements UpdateInBack
FileModificationService.getInstance().preparePsiElementsForWrite(elementToMakeWritable))) {
return;
}
if (elementToMakeWritable instanceof PsiCompiledElement) {
return;
}
CommandProcessor.getInstance().executeCommand(project, () -> {
final Runnable action = () -> {