From a1632367139237ec131a81bb6aa59ce142208447 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Wed, 19 Sep 2012 18:31:54 +0400 Subject: [PATCH] KT-2128 Code completion after number with dot - no tests for now #KT-2128 In Progress --- idea/src/META-INF/plugin.xml | 2 + .../completion/JetReferenceCharFilter.java | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 idea/src/org/jetbrains/jet/plugin/completion/JetReferenceCharFilter.java diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 8597d8095cb..06eb68648b3 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -144,6 +144,8 @@ + + diff --git a/idea/src/org/jetbrains/jet/plugin/completion/JetReferenceCharFilter.java b/idea/src/org/jetbrains/jet/plugin/completion/JetReferenceCharFilter.java new file mode 100644 index 00000000000..d4f27513ea9 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/completion/JetReferenceCharFilter.java @@ -0,0 +1,43 @@ +/* + * Copyright 2010-2012 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.jet.plugin.completion; + +import com.intellij.codeInsight.completion.CompletionCharFilter; +import com.intellij.codeInsight.lookup.CharFilter; +import com.intellij.codeInsight.lookup.Lookup; +import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.lang.psi.JetFile; + +public class JetReferenceCharFilter extends CharFilter { + private final static CharFilter delegate = new CompletionCharFilter(); + + @Override + @Nullable + public Result acceptChar(char c, int prefixLength, Lookup lookup) { + final PsiFile psiFile = lookup.getPsiFile(); + if (!(psiFile instanceof JetFile)) { + return null; + } + + if (c == '.') { + return Result.HIDE_LOOKUP; + } + + return delegate.acceptChar(c, prefixLength, lookup); + } +} \ No newline at end of file