PY-48012 Resolve and complete attributes in PEP 634 class patterns

Both are implemented other the type of the corresponding class.
References resolve to any readable attribute of a class, however
some obviously wrong variants such as special "dunder" attributes
and methods are intentionally excluded from completion suggestions.

GitOrigin-RevId: 5edac14f47cba39840b15b0dd7f21e2e46077261
This commit is contained in:
Mikhail Golubev
2021-07-09 20:29:00 +03:00
committed by intellij-monorepo-bot
parent d15bf8a552
commit 1421975c96
49 changed files with 698 additions and 8 deletions

View File

@@ -1,5 +1,10 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.psi;
import org.jetbrains.annotations.NotNull;
public interface PyClassPattern extends PyPattern {
@NotNull PyReferenceExpression getClassNameReference();
@NotNull PyPatternArgumentList getArgumentList();
}

View File

@@ -47,6 +47,9 @@ public abstract class PyElementGenerator {
@NotNull
public abstract PyExpression createExpressionFromText(@NotNull LanguageLevel languageLevel, @NotNull String text) throws IncorrectOperationException;
@NotNull
public abstract PyPattern createPatternFromText(@NotNull LanguageLevel languageLevel, @NotNull String text) throws IncorrectOperationException;
/**
* Adds elements to list inserting required commas.

View File

@@ -1,5 +1,14 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.psi;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface PyKeywordPattern extends PyPattern {
@NotNull String getKeyword();
@NotNull PsiElement getKeywordElement();
@Nullable PyPattern getValuePattern();
}