PY-61639 Move PythonFormattingModelBuilder to python.syntax.core

GitOrigin-RevId: bdcbd076cd3c1531204eff35515b44cd0edc9f68
This commit is contained in:
Petr
2024-02-08 21:19:05 +01:00
committed by intellij-monorepo-bot
parent da4a4b066b
commit 85c54b3a4c
39 changed files with 469 additions and 386 deletions

View File

@@ -15,7 +15,6 @@
*/
package com.jetbrains.python.psi;
import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.jetbrains.python.ast.PyAstTypeCommentOwner;
import org.jetbrains.annotations.Nullable;
@@ -24,20 +23,6 @@ import org.jetbrains.annotations.Nullable;
* @author Mikhail Golubev
*/
public interface PyTypeCommentOwner extends PyAstTypeCommentOwner, PsiElement {
/**
* Returns a special comment that follows element definition and starts with conventional "type:" prefix.
* It is supposed to contain type annotation in PEP 484 compatible format. For further details see sections
* <a href="https://www.python.org/dev/peps/pep-0484/#type-comments">Type Comments</a> and
* <a href="https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code">Suggested syntax for Python 2.7 and straddling code</a> and
* in PEP 484.
* <p/>
* Use {@link #getTypeCommentAnnotation()} to get its content with the prefix stripped accessing either stubs or AST.
*
* @see #getTypeCommentAnnotation()
*/
@Nullable
PsiComment getTypeComment();
/**
* Returns type annotation after the "type:" prefix extracted from the commentary returned by {@link #getTypeComment()}.
*

View File

@@ -90,24 +90,6 @@ public final class PyPsiUtils {
return PsiTreeUtil.skipWhitespacesForward(element);
}
/**
* Returns the first non-whitespace sibling following the given element but within its line boundaries.
*/
@Nullable
public static PsiElement getNextNonWhitespaceSiblingOnSameLine(@NotNull PsiElement element) {
PsiElement cur = element.getNextSibling();
while (cur != null) {
if (!(cur instanceof PsiWhiteSpace)) {
return cur;
}
else if (cur.textContains('\n')) {
break;
}
cur = cur.getNextSibling();
}
return null;
}
/**
* Returns the first non-whitespace sibling preceding the given element but within its line boundaries.
*/