performance: don't ask next TemplateContextProvider for references if previous one gave a satisfactory result (PY-7384)

This commit is contained in:
Dmitry Jemerov
2012-08-30 19:48:27 +02:00
parent 36ebf9ef46
commit 0134a6cd36
2 changed files with 9 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ package com.jetbrains.python.templateLanguages;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
@@ -34,7 +35,8 @@ public interface TemplateContextProvider {
* name of the variable; the object is the PsiElement declaring the variable.
*
* @param template the template file
* @return the list of variables
* @return the list of variables, or null if the template is not used in the context handled by this processor.
*/
@Nullable
Collection<LookupElement> getTemplateContext(PsiFile template);
}

View File

@@ -606,4 +606,10 @@ public class PythonCompletionTest extends PyTestCase {
" pass\n" +
"except IOError <caret>").contains("as"));
}
public void testElseInFor() { // PY-6755
assertTrue(doTestByText("for item in range(10):\n" +
" pass\n" +
"el<caret>").contains("else"));
}
}