mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
performance: don't ask next TemplateContextProvider for references if previous one gave a satisfactory result (PY-7384)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user