Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
a20af2bf
Commit
a20af2bf
authored
7 years ago
by
peter
Browse files
Options
Download
Email Patches
Plain Diff
checkPsiMatchesTextIgnoringNonCode: ignore outers, make diffs shorter
parent
42ef47c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
platform/core-impl/src/com/intellij/psi/impl/DebugUtil.java
+3
-1
platform/core-impl/src/com/intellij/psi/impl/DebugUtil.java
platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java
+12
-1
...Framework/src/com/intellij/testFramework/PsiTestUtil.java
with
15 additions
and
2 deletions
+15
-2
platform/core-impl/src/com/intellij/psi/impl/DebugUtil.java
+
3
-
1
View file @
a20af2bf
...
...
@@ -18,6 +18,7 @@ import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import
com.intellij.psi.impl.source.tree.*
;
import
com.intellij.psi.stubs.ObjectStubSerializer
;
import
com.intellij.psi.stubs.Stub
;
import
com.intellij.psi.templateLanguages.OuterLanguageElement
;
import
com.intellij.psi.tree.IElementType
;
import
com.intellij.psi.util.PsiUtilCore
;
import
com.intellij.util.*
;
...
...
@@ -404,7 +405,8 @@ public class DebugUtil {
@Override
protected
boolean
shouldSkipNode
(
TreeElement
node
)
{
return
super
.
shouldSkipNode
(
node
)
||
node
instanceof
PsiErrorElement
||
node
instanceof
PsiComment
||
node
instanceof
LeafPsiElement
&&
StringUtil
.
isEmptyOrSpaces
(
node
.
getText
());
node
instanceof
LeafPsiElement
&&
StringUtil
.
isEmptyOrSpaces
(
node
.
getText
())
||
node
instanceof
OuterLanguageElement
;
}
@Override
...
...
This diff is collapsed.
Click to expand it.
platform/testFramework/src/com/intellij/testFramework/PsiTestUtil.java
+
12
-
1
View file @
a20af2bf
...
...
@@ -224,7 +224,18 @@ public class PsiTestUtil {
String
psiTree
=
StringUtil
.
join
(
file
.
getViewProvider
().
getAllFiles
(),
fun
,
"\n"
);
String
reparsedTree
=
StringUtil
.
join
(
dummyFile
.
getViewProvider
().
getAllFiles
(),
fun
,
"\n"
);
if
(!
psiTree
.
equals
(
reparsedTree
))
{
Assert
.
assertEquals
(
"Re-created from text:\n"
+
reparsedTree
,
"PSI structure:\n"
+
psiTree
);
String
[]
psiLines
=
StringUtil
.
splitByLines
(
psiTree
);
String
[]
reparsedLines
=
StringUtil
.
splitByLines
(
reparsedTree
);
for
(
int
i
=
0
;
;
i
++)
{
if
(
i
>=
psiLines
.
length
||
i
>=
reparsedLines
.
length
||
!
psiLines
[
i
].
equals
(
reparsedLines
[
i
]))
{
psiLines
[
Math
.
min
(
i
,
psiLines
.
length
-
1
)]
+=
" // in PSI structure"
;
reparsedLines
[
Math
.
min
(
i
,
reparsedLines
.
length
-
1
)]
+=
" // re-created from text"
;
break
;
}
}
psiTree
=
StringUtil
.
join
(
psiLines
,
"\n"
);
reparsedTree
=
StringUtil
.
join
(
reparsedLines
,
"\n"
);
Assert
.
assertEquals
(
reparsedTree
,
psiTree
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment