mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
PY-19917 Support type ignore comments
(cherry picked from commit 693b7f2bf037ac9fd464e330390c76ee5268c023) IJ-MR-5695 GitOrigin-RevId: 354a4ba98e0ff01787ae0718c8643772b118fc9f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4ca740f0e6
commit
3322cedc0d
@@ -662,4 +662,21 @@ public final class PyPsiUtils {
|
||||
return element.getText();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiComment findSameLineComment(@NotNull PsiElement elem) {
|
||||
// If `elem` is a compound multi-line element, stick to its first line nonetheless
|
||||
PsiElement next = PsiTreeUtil.getDeepestFirst(elem);
|
||||
do {
|
||||
if (next instanceof PsiComment) {
|
||||
return (PsiComment)next;
|
||||
}
|
||||
if (next != elem && next.textContains('\n')) {
|
||||
break;
|
||||
}
|
||||
next = PsiTreeUtil.nextLeaf(next);
|
||||
}
|
||||
while (next != null);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user