diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/UnInjectLanguageAction.java b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/UnInjectLanguageAction.java index 5c1c8c51bc51..4d27fa305b14 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/UnInjectLanguageAction.java +++ b/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/UnInjectLanguageAction.java @@ -75,7 +75,8 @@ public class UnInjectLanguageAction implements IntentionAction, LowPriorityActio final PsiFile psiFile = InjectedLanguageUtil.findInjectedPsiNoCommit(file, offset); if (psiFile == null) { PsiReference reference = file.findReferenceAt(offset); - if (reference != null && reference.getElement() instanceof PsiLanguageInjectionHost) { + if (reference == null) return; + if (reference.getElement() instanceof PsiLanguageInjectionHost) { PsiLanguageInjectionHost host = (PsiLanguageInjectionHost)reference.getElement(); for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { if (support.isApplicableTo(host) && support.removeInjectionInPlace(host)) { @@ -84,6 +85,13 @@ public class UnInjectLanguageAction implements IntentionAction, LowPriorityActio } } } + PsiElement element = reference.getElement(); + LanguageInjectionSupport support = element.getUserData(LanguageInjectionSupport.INJECTOR_SUPPORT); + if (support != null) { + if (support.removeInjection(element)) { + ((PsiModificationTrackerImpl)PsiManager.getInstance(project).getModificationTracker()).incCounter(); + } + } return; } final PsiLanguageInjectionHost host = InjectedLanguageManager.getInstance(project).getInjectionHost(psiFile);