diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/BaseCodeCompletionAction.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/BaseCodeCompletionAction.java
index d05cff0b7c48..10596197e99d 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/BaseCodeCompletionAction.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/actions/BaseCodeCompletionAction.java
@@ -42,6 +42,7 @@ public abstract class BaseCodeCompletionAction extends AnAction implements HintM
protected BaseCodeCompletionAction(CompletionType completionType) {
myCompletionType = completionType;
setEnabledInModalContext(true);
+ setInjectedContext(true);
}
public void actionPerformed(AnActionEvent e) {
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/InjectedGroovyTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/InjectedGroovyTest.groovy
new file mode 100644
index 000000000000..be081f16927d
--- /dev/null
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/completion/InjectedGroovyTest.groovy
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2000-2011 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.completion
+
+import com.intellij.psi.util.PsiTreeUtil
+import com.intellij.psi.xml.XmlText
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+import org.intellij.plugins.intelliLang.inject.TemporaryPlacesRegistry
+import org.jetbrains.plugins.groovy.GroovyFileType
+
+/**
+ * @author peter
+ */
+class InjectedGroovyTest extends LightCodeInsightFixtureTestCase {
+
+ public void testTabMethodParentheses() {
+ myFixture.configureByText("a.xml", """
+String s = "foo"
+s.codePocharAt(0)
+""")
+
+ def host = PsiTreeUtil.findElementOfClassAtOffset(myFixture.file, myFixture.editor.caretModel.offset, XmlText, false)
+ TemporaryPlacesRegistry.getInstance(project).getLanguageInjectionSupport().addInjectionInPlace(GroovyFileType.GROOVY_LANGUAGE, host);
+
+ myFixture.completeBasic()
+ myFixture.type('\t')
+ myFixture.checkResult("""
+String s = "foo"
+s.codePointAt(0)
+""")
+ }
+
+}