@@ -0,0 +1,1613 @@
+/*%0D%0A * Copyright 2010 Jon S Akhtar (Sylvanaar)%0D%0A *%0D%0A *   Licensed under the Apache License, Version 2.0 (the %22License%22);%0D%0A *   you may not use this file except in compliance with the License.%0D%0A *   You may obtain a copy of the License at%0D%0A *%0D%0A *   http://www.apache.org/licenses/LICENSE-2.0%0D%0A *%0D%0A *   Unless required by applicable law or agreed to in writing, software%0D%0A *   distributed under the License is distributed on an %22AS IS%22 BASIS,%0D%0A *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0D%0A *   See the License for the specific language governing permissions and%0D%0A *   limitations under the License.%0D%0A */%0D%0A%0D%0Apackage com.sylvanaar.idea.Lua.editor.completion;%0D%0A%0D%0Aimport com.intellij.codeInsight.lookup.CharFilter;%0D%0Aimport com.intellij.codeInsight.lookup.Lookup;%0D%0Aimport com.intellij.psi.PsiFile;%0D%0Aimport com.sylvanaar.idea.Lua.LuaFileType;%0D%0Aimport org.jetbrains.annotations.Nullable;%0D%0A%0D%0A/**%0D%0A * Created by IntelliJ IDEA.%0D%0A * User: Jon S Akhtar%0D%0A * Date: Nov 21, 2010%0D%0A * Time: 6:53:07 PM%0D%0A */%0D%0Apublic class LuaCharFilter extends CharFilter %7B%0D%0A    @Nullable%0D%0A    public Result acceptChar(char c, int pefixLength, Lookup lookup) %7B%0D%0A        final PsiFile psiFile = lookup.getPsiFile();%0D%0A        if (psiFile != null && !psiFile.getViewProvider().getLanguages().contains(LuaFileType.LUA_LANGUAGE))%0D%0A            return null;%0D%0A%0D%0A        if (Character.isJavaIdentifierPart(c) %7C%7C c == '%5C'') %7B%0D%0A            return Result.ADD_TO_PREFIX;%0D%0A        %7D%0D%0A%0D%0A        if (c == '%5Cn' %7C%7C c == '%5Ct') %7B%0D%0A            return Result.SELECT_ITEM_AND_FINISH_LOOKUP;%0D%0A        %7D%0D%0A%0D%0A        return null;%0D%0A    %7D%0D%0A%0D%0A%7D%0D%0A

add a char filter for completions so we can end the completion and start a new one