From ef546d12317f6750d18aca871063d2e3feb2e2d3 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Tue, 13 Jan 2015 12:59:27 +0300 Subject: [PATCH] IDEA-15956 Ctrl-/ does not work in pointcut language --- .../actions/CommentByLineCommentAction.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByLineCommentAction.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByLineCommentAction.java index 3ee4ecc4d65e..5dacd22f50d5 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByLineCommentAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/actions/CommentByLineCommentAction.java @@ -19,14 +19,16 @@ package com.intellij.codeInsight.generation.actions; import com.intellij.codeInsight.actions.MultiCaretCodeInsightAction; import com.intellij.codeInsight.actions.MultiCaretCodeInsightActionHandler; import com.intellij.codeInsight.generation.CommentByLineCommentHandler; +import com.intellij.lang.LanguageCommenters; +import com.intellij.lang.injection.InjectedLanguageManager; import com.intellij.openapi.editor.Caret; -import com.intellij.openapi.fileTypes.impl.AbstractFileType; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileTypes.FileType; +import com.intellij.openapi.fileTypes.impl.AbstractFileType; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; -import com.intellij.lang.LanguageCommenters; import org.jetbrains.annotations.NotNull; public class CommentByLineCommentAction extends MultiCaretCodeInsightAction implements DumbAware { @@ -46,6 +48,10 @@ public class CommentByLineCommentAction extends MultiCaretCodeInsightAction impl if (fileType instanceof AbstractFileType) { return ((AbstractFileType)fileType).getCommenter() != null; } - return LanguageCommenters.INSTANCE.forLanguage(file.getLanguage()) != null || LanguageCommenters.INSTANCE.forLanguage(file.getViewProvider().getBaseLanguage()) != null; + + if (LanguageCommenters.INSTANCE.forLanguage(file.getLanguage()) != null || + LanguageCommenters.INSTANCE.forLanguage(file.getViewProvider().getBaseLanguage()) != null) return true; + PsiElement host = InjectedLanguageManager.getInstance(project).getInjectionHost(file); + return host != null && LanguageCommenters.INSTANCE.forLanguage(host.getLanguage()) != null; } }