mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed test in dict keys completion
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.jetbrains.python.codeInsight;
|
||||
|
||||
import com.intellij.codeInsight.completion.*;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -25,16 +24,6 @@ import static com.intellij.patterns.PlatformPatterns.psiElement;
|
||||
* Complete known keys for dictionaries
|
||||
*/
|
||||
public class PyDictKeyNamesCompletionContributor extends PySeeingOriginalCompletionContributor {
|
||||
@Override
|
||||
public AutoCompletionDecision handleAutoCompletionPossibility(AutoCompletionContext context) {
|
||||
// auto-insert the obvious only case; else show other cases.
|
||||
final LookupElement[] items = context.getItems();
|
||||
if (items.length == 1) {
|
||||
return AutoCompletionDecision.insertItem(items[0]);
|
||||
}
|
||||
return AutoCompletionDecision.SHOW_LOOKUP;
|
||||
}
|
||||
|
||||
private static final FilterPattern DICT_KEY = new FilterPattern(
|
||||
new InSequenceFilter(psiElement(PySubscriptionExpression.class))
|
||||
);
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
tasks = {key: "123"}
|
||||
tasks[key]
|
||||
@@ -1,2 +1,2 @@
|
||||
tasks = {'123': "123"}
|
||||
tasks['<caret>1]
|
||||
tasks = {key: "123"}
|
||||
tasks[ke<caret>]
|
||||
@@ -223,11 +223,7 @@ public class PythonCompletionTest extends PyLightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testDictKeys() { // PY-2245
|
||||
final String testName = "completion/" + getTestName(true) + ".py";
|
||||
myFixture.configureByFile(testName);
|
||||
final LookupElement[] elements = myFixture.completeBasic();
|
||||
assertEquals(1, elements.length);
|
||||
assertEquals("'123'", elements [0].getLookupString());
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testNoParensForDecorator() { // PY-2210
|
||||
|
||||
Reference in New Issue
Block a user