mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-12932 Fix trailing comment detection when it's the first child element
This commit is contained in:
@@ -132,6 +132,6 @@ public class PyPreFormatProcessor implements PreFormatProcessor {
|
||||
|
||||
private static boolean isTrailingComment(@NotNull PsiComment comment) {
|
||||
final PsiElement prevElement = comment.getPrevSibling();
|
||||
return !(prevElement instanceof PsiWhiteSpace) || !prevElement.textContains('\n');
|
||||
return prevElement != null && (!(prevElement instanceof PsiWhiteSpace) || !prevElement.textContains('\n'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# This normal comment won't be touched as well
|
||||
# for a in [1, 2, 3]:
|
||||
# if a == 1:
|
||||
# print 'x'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# This normal comment won't be touched as well
|
||||
# for a in [1, 2, 3]:
|
||||
# if a == 1:
|
||||
# print 'x'
|
||||
|
||||
Reference in New Issue
Block a user