From 4eed30b7f3d098087ce3856620016f68a337a81e Mon Sep 17 00:00:00 2001 From: "peter.gromov" Date: Sat, 13 Nov 2010 18:34:13 +0300 Subject: [PATCH] don't focus autopopup (whatever there is) in java&groovy comments --- .../completion/UnfocusedComments.java | 33 +++++++++++++++++++ plugins/groovy/src/META-INF/plugin.xml | 1 + resources/src/META-INF/IdeaPlugin.xml | 1 + 3 files changed, 35 insertions(+) create mode 100644 platform/lang-api/src/com/intellij/codeInsight/completion/UnfocusedComments.java diff --git a/platform/lang-api/src/com/intellij/codeInsight/completion/UnfocusedComments.java b/platform/lang-api/src/com/intellij/codeInsight/completion/UnfocusedComments.java new file mode 100644 index 000000000000..0372a0e00941 --- /dev/null +++ b/platform/lang-api/src/com/intellij/codeInsight/completion/UnfocusedComments.java @@ -0,0 +1,33 @@ +/* + * Copyright 2000-2010 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 com.intellij.codeInsight.completion; + +import com.intellij.psi.PsiComment; +import com.intellij.psi.util.PsiTreeUtil; +import org.jetbrains.annotations.NotNull; + +/** + * @author peter + */ +public class UnfocusedComments extends CompletionConfidence { + @Override + public Boolean shouldFocusLookup(@NotNull CompletionParameters parameters) { + if (PsiTreeUtil.getParentOfType(parameters.getPosition(), PsiComment.class) != null) { + return false; + } + return null; + } +} diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index 727436fd6114..e04ecf31d5d5 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -182,6 +182,7 @@ + diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml index b472d5100535..46131f2b8817 100644 --- a/resources/src/META-INF/IdeaPlugin.xml +++ b/resources/src/META-INF/IdeaPlugin.xml @@ -231,6 +231,7 @@ id="excludeFromCompletion" order="last"/> +