mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
getting rid of PrecededByFilter
This commit is contained in:
@@ -327,8 +327,8 @@ public class PyKeywordCompletionContributor extends PySeeingOriginalCompletionCo
|
||||
|
||||
private static final FilterPattern IN_DEFINITION = new FilterPattern(new InDefinitionFilter());
|
||||
|
||||
private static final FilterPattern AFTER_IF = new FilterPattern(new PrecededByFilter(psiElement(PyIfStatement.class)));
|
||||
private static final FilterPattern AFTER_TRY = new FilterPattern(new PrecededByFilter(psiElement(PyTryExceptStatement.class)));
|
||||
private static final PsiElementPattern.Capture<PsiElement> AFTER_IF = afterStatement(psiElement(PyIfStatement.class));
|
||||
private static final PsiElementPattern.Capture<PsiElement> AFTER_TRY = afterStatement(psiElement(PyTryExceptStatement.class));
|
||||
|
||||
private static final FilterPattern AFTER_LOOP_NO_ELSE = new FilterPattern(new PrecededByFilter(
|
||||
psiElement()
|
||||
@@ -336,9 +336,14 @@ public class PyKeywordCompletionContributor extends PySeeingOriginalCompletionCo
|
||||
.withLastChild(StandardPatterns.not(psiElement(PyElsePart.class)))
|
||||
));
|
||||
|
||||
private static final FilterPattern AFTER_COND_STMT_NO_ELSE = new FilterPattern(new PrecededByFilter(
|
||||
psiElement().withChild(psiElement(PyConditionalStatementPart.class)).withLastChild(StandardPatterns.not(psiElement(PyElsePart.class)))
|
||||
));
|
||||
private static final PsiElementPattern.Capture<PsiElement> AFTER_COND_STMT_NO_ELSE =
|
||||
afterStatement(psiElement().withChild(psiElement(PyConditionalStatementPart.class))
|
||||
.withLastChild(StandardPatterns.not(psiElement(PyElsePart.class))));
|
||||
|
||||
private static <T extends PsiElement> PsiElementPattern.Capture<PsiElement> afterStatement(final PsiElementPattern.Capture<T> statementPattern) {
|
||||
return psiElement().atStartOf(psiElement(PyExpressionStatement.class)
|
||||
.afterSiblingSkipping(psiElement().whitespaceCommentEmptyOrError(), statementPattern));
|
||||
}
|
||||
|
||||
private static final FilterPattern AFTER_TRY_NO_ELSE = new FilterPattern(new PrecededByFilter(
|
||||
psiElement().withChild(psiElement(PyTryPart.class)).withLastChild(StandardPatterns.not(psiElement(PyElsePart.class)))
|
||||
|
||||
3
python/testData/completion/elifNotIndented.after.py
Normal file
3
python/testData/completion/elifNotIndented.after.py
Normal file
@@ -0,0 +1,3 @@
|
||||
if True:
|
||||
a = 1
|
||||
elif <caret>:
|
||||
3
python/testData/completion/elifNotIndented.py
Normal file
3
python/testData/completion/elifNotIndented.py
Normal file
@@ -0,0 +1,3 @@
|
||||
if True:
|
||||
a = 1
|
||||
eli<caret>
|
||||
3
python/testData/completion/elseNotIndented.after.py
Normal file
3
python/testData/completion/elseNotIndented.after.py
Normal file
@@ -0,0 +1,3 @@
|
||||
if True:
|
||||
a = 1
|
||||
else:
|
||||
3
python/testData/completion/elseNotIndented.py
Normal file
3
python/testData/completion/elseNotIndented.py
Normal file
@@ -0,0 +1,3 @@
|
||||
if True:
|
||||
a = 1
|
||||
els<caret>
|
||||
3
python/testData/completion/exceptNotIndented.after.py
Normal file
3
python/testData/completion/exceptNotIndented.after.py
Normal file
@@ -0,0 +1,3 @@
|
||||
try:
|
||||
a = 1
|
||||
except <caret>:
|
||||
3
python/testData/completion/exceptNotIndented.py
Normal file
3
python/testData/completion/exceptNotIndented.py
Normal file
@@ -0,0 +1,3 @@
|
||||
try:
|
||||
a = 1
|
||||
exce<caret>
|
||||
@@ -265,15 +265,27 @@ public class PythonCompletionTest extends PyLightFixtureTestCase {
|
||||
public void testElse() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testElseNotIndented() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testElif() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testElifNotIndented() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExcept() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExceptNotIndented() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testFinallyInExcept() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user