mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[param hints] more flaky test logging
This commit is contained in:
@@ -25,8 +25,6 @@ import com.intellij.psi.util.TypeConversionUtil
|
||||
|
||||
object JavaInlayHintsProvider {
|
||||
|
||||
var isDebug = false
|
||||
|
||||
fun createHints(callExpression: PsiCallExpression): Set<InlayInfo> {
|
||||
val resolveResult = callExpression.resolveMethodGenerics()
|
||||
val hints = createHintsForResolvedMethod(callExpression, resolveResult)
|
||||
@@ -181,8 +179,8 @@ object JavaInlayHintsProvider {
|
||||
else -> false
|
||||
}
|
||||
|
||||
if (isDebug) {
|
||||
println("${callArgument.text} : ${callArgument.javaClass} : isShowHint->$isShowHint")
|
||||
if (ParameterHintsPassFactory.isDebug()) {
|
||||
println("${System.nanoTime()}: ${callArgument.text} : ${callArgument.javaClass} : isShowHint->$isShowHint")
|
||||
}
|
||||
|
||||
return isShowHint
|
||||
|
||||
+6
@@ -17,6 +17,7 @@ package com.intellij.codeInsight.daemon.inlays
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.ParameterHintsPresentationManager
|
||||
import com.intellij.codeInsight.hints.InlayInfo
|
||||
import com.intellij.codeInsight.hints.ParameterHintsPassFactory
|
||||
import com.intellij.codeInsight.hints.settings.ParameterNameHintsSettings
|
||||
import com.intellij.openapi.command.WriteCommandAction
|
||||
import com.intellij.openapi.editor.Document
|
||||
@@ -87,6 +88,11 @@ abstract class InlayParameterHintsTest : LightCodeInsightFixtureTestCase() {
|
||||
myFixture.doHighlighting()
|
||||
val editor = myFixture.editor
|
||||
val allInlays = editor.inlayModel.getInlineElementsInRange(0, editor.document.textLength)
|
||||
|
||||
if (ParameterHintsPassFactory.isDebug()) {
|
||||
println("${System.nanoTime()}: [HintTests] inlays extracted")
|
||||
}
|
||||
|
||||
val hintManager = ParameterHintsPresentationManager.getInstance()
|
||||
return allInlays
|
||||
.filter { hintManager.isParameterHint(it) }
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.daemon.inlays
|
||||
|
||||
import com.intellij.codeInsight.hints.JavaInlayHintsProvider
|
||||
import com.intellij.codeInsight.hints.ParameterHintsPassFactory
|
||||
import com.intellij.codeInsight.hints.settings.ParameterNameHintsSettings
|
||||
import com.intellij.lang.java.JavaLanguage
|
||||
|
||||
@@ -573,7 +573,7 @@ class Key {
|
||||
|
||||
fun `test poly and binary expressions`() {
|
||||
try {
|
||||
JavaInlayHintsProvider.isDebug = true
|
||||
ParameterHintsPassFactory.setDebug(true)
|
||||
check("""
|
||||
class Test {
|
||||
void test() {
|
||||
@@ -589,7 +589,7 @@ class Test {
|
||||
""")
|
||||
}
|
||||
finally {
|
||||
JavaInlayHintsProvider.isDebug = false
|
||||
ParameterHintsPassFactory.setDebug(false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.intellij.util.containers.HashSet;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -50,6 +51,18 @@ import java.util.stream.Collectors;
|
||||
public class ParameterHintsPassFactory extends AbstractProjectComponent implements TextEditorHighlightingPassFactory {
|
||||
private static final Key<Boolean> REPEATED_PASS = Key.create("RepeatedParameterHintsPass");
|
||||
|
||||
private static boolean isDebug = false;
|
||||
|
||||
@TestOnly
|
||||
public static void setDebug(boolean value) {
|
||||
isDebug = value;
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static boolean isDebug() {
|
||||
return isDebug;
|
||||
}
|
||||
|
||||
public ParameterHintsPassFactory(Project project, TextEditorHighlightingPassRegistrar registrar) {
|
||||
super(project);
|
||||
registrar.registerTextEditorHighlightingPass(this, null, null, false, -1);
|
||||
@@ -91,7 +104,15 @@ public class ParameterHintsPassFactory extends AbstractProjectComponent implemen
|
||||
.filter((e) -> e != null)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (isDebug) {
|
||||
System.out.println(System.nanoTime() + ": [HintsPass] Traversing started");
|
||||
}
|
||||
|
||||
SyntaxTraverser.psiTraverser(myFile).forEach(element -> process(element, provider, matchers));
|
||||
|
||||
if (isDebug) {
|
||||
System.out.println(System.nanoTime() + ": [HintsPass] Traversing ended");
|
||||
}
|
||||
}
|
||||
|
||||
private static Set<String> getBlackList(Language language) {
|
||||
|
||||
Reference in New Issue
Block a user