mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-48665 Disable f-string-like completion in literal string patterns
Since f-strings are not supported inside patterns. GitOrigin-RevId: f96b8b6e999c893930203f933c6f55aec6e60869
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9247e2eb84
commit
09c9fc2898
+3
-2
@@ -35,13 +35,14 @@ import static com.jetbrains.python.psi.PyUtil.as;
|
||||
*/
|
||||
public class PyFStringLikeCompletionContributor extends CompletionContributor {
|
||||
|
||||
private static final PsiElementPattern.Capture<PyPlainStringElement> INSIDE_NON_FORMATTED_STRING_ELEMENT =
|
||||
private static final PsiElementPattern.Capture<PyPlainStringElement> APPLICABLE_STRING_ELEMENT =
|
||||
psiElement(PyPlainStringElement.class)
|
||||
.withParent(PyStringLiteralExpression.class)
|
||||
.andNot(psiElement().withSuperParent(2, PyLiteralPattern.class))
|
||||
.andNot(psiElement().inside(PyStringFormatCompletionContributor.FORMAT_STRING_CAPTURE));
|
||||
|
||||
public PyFStringLikeCompletionContributor() {
|
||||
extend(CompletionType.BASIC, INSIDE_NON_FORMATTED_STRING_ELEMENT, new CompletionProvider<>() {
|
||||
extend(CompletionType.BASIC, APPLICABLE_STRING_ELEMENT, new CompletionProvider<>() {
|
||||
@Override
|
||||
protected void addCompletions(@NotNull CompletionParameters parameters,
|
||||
@NotNull ProcessingContext context,
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
my_expr = 42
|
||||
match my_expr:
|
||||
case '{my_e<caret>':
|
||||
pass
|
||||
@@ -474,6 +474,11 @@ public class Py3CompletionTest extends PyTestCase {
|
||||
assertContainsElements(myFixture.getLookupElementStrings(), "city");
|
||||
}
|
||||
|
||||
// PY-48665
|
||||
public void testFStringLikeCompletionNotAvailableInLiteralPatterns() {
|
||||
doNegativeTest();
|
||||
}
|
||||
|
||||
// PY-46056
|
||||
public void testImportCompletionHintForSameDirectoryModuleInOrdinaryPackage() {
|
||||
doTestVariantTailText("ordinaryPackage/sample.py", "logging", null);
|
||||
|
||||
Reference in New Issue
Block a user