mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
added tests for selection
This commit is contained in:
+6
-2
@@ -3,6 +3,7 @@ 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.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiReference;
|
||||
@@ -88,8 +89,11 @@ public class PyDictKeyNamesCompletionContributor extends PySeeingOriginalComplet
|
||||
private static CompletionResultSet createResult(PsiElement original, CompletionResultSet result) {
|
||||
PsiElement prevElement = original.getPrevSibling();
|
||||
if (prevElement != null) {
|
||||
if (prevElement.getNode().getElementType() != PyTokenTypes.LBRACKET)
|
||||
return result.withPrefixMatcher(findPrefix(prevElement));
|
||||
ASTNode prevNode = prevElement.getNode();
|
||||
if (prevNode != null) {
|
||||
if (prevNode.getElementType() != PyTokenTypes.LBRACKET)
|
||||
return result.withPrefixMatcher(findPrefix(prevElement));
|
||||
}
|
||||
}
|
||||
PsiElement parentElement = original.getParent();
|
||||
if (parentElement != null) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
d = {'school_id':parent_id, "next": <selection>next</selection>}
|
||||
@@ -0,0 +1 @@
|
||||
d = {'school_id':parent_id, <selection>"next": next</selection>}
|
||||
@@ -0,0 +1 @@
|
||||
d = {'school_id':parent_id<selection>, "next": next</selection>}
|
||||
@@ -0,0 +1 @@
|
||||
d = {'school_id':parent_id, "next": ne<caret>xt}
|
||||
@@ -0,0 +1 @@
|
||||
x = [1, 2, 3, <selection>4</selection>]
|
||||
@@ -0,0 +1 @@
|
||||
x = [1, 2, 3<selection>, 4</selection>]
|
||||
@@ -0,0 +1 @@
|
||||
x = [<selection>1, 2, 3, 4</selection>]
|
||||
@@ -0,0 +1 @@
|
||||
x = [1, 2, 3, 4<caret>]
|
||||
@@ -23,6 +23,14 @@ public class PySelectWordTest extends PyLightFixtureTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testList() { // PY-1686
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testComma() { // PY-1378
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
@NonNls final String path = "selectWord/" + getTestName(true);
|
||||
myFixture.copyDirectoryToProject(path, path);
|
||||
|
||||
Reference in New Issue
Block a user