Make JetTestUtils.getLastCommentInFile() to allow trailing newline
Many editors add a trailing newline when saving. Allow them in getLastCommentInFile.
This commit is contained in:
committed by
Nikolay Krasko
parent
420a08167b
commit
7429cc8819
@@ -531,6 +531,9 @@ public class JetTestUtils {
|
|||||||
|
|
||||||
public static String getLastCommentInFile(JetFile file) {
|
public static String getLastCommentInFile(JetFile file) {
|
||||||
PsiElement lastChild = file.getLastChild();
|
PsiElement lastChild = file.getLastChild();
|
||||||
|
if (lastChild != null && lastChild.getNode().getElementType().equals(JetTokens.WHITE_SPACE)) {
|
||||||
|
lastChild = lastChild.getPrevSibling();
|
||||||
|
}
|
||||||
assert lastChild != null;
|
assert lastChild != null;
|
||||||
|
|
||||||
if (lastChild.getNode().getElementType().equals(JetTokens.BLOCK_COMMENT)) {
|
if (lastChild.getNode().getElementType().equals(JetTokens.BLOCK_COMMENT)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user