Enabled Kotlin internal mode in JetPsiChecker tests.
This commit is contained in:
+7
-3
@@ -25,17 +25,21 @@ public class KotlinInternalModeToggleAction: ToggleAction("Kotlin Internal Mode"
|
||||
public class object {
|
||||
val INTERNAL_MODE_PROPERTY = "kotlin.internal.mode.enabled"
|
||||
|
||||
public fun isEnabled(): Boolean {
|
||||
public var enabled: Boolean
|
||||
get() {
|
||||
return PropertiesComponent.getInstance()!!.getBoolean(INTERNAL_MODE_PROPERTY, false)
|
||||
}
|
||||
set(value) {
|
||||
PropertiesComponent.getInstance()!!.setValue(INTERNAL_MODE_PROPERTY, value.toString())
|
||||
}
|
||||
}
|
||||
|
||||
override fun isSelected(e: AnActionEvent?): Boolean {
|
||||
return isEnabled()
|
||||
return enabled
|
||||
}
|
||||
|
||||
override fun setSelected(e: AnActionEvent?, state: Boolean) {
|
||||
PropertiesComponent.getInstance()!!.setValue(INTERNAL_MODE_PROPERTY, "$state")
|
||||
enabled = state
|
||||
|
||||
DaemonCodeAnalyzer.getInstance(e!!.getProject())!!.settingsChanged()
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.jetbrains.jet.plugin.caches.resolve.ResolvePackage;
|
||||
public class DebugInfoAnnotator implements Annotator {
|
||||
|
||||
public static boolean isDebugInfoEnabled() {
|
||||
return KotlinInternalModeToggleAction.OBJECT$.isEnabled();
|
||||
return KotlinInternalModeToggleAction.OBJECT$.getEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -264,7 +264,7 @@ public class JetPsiChecker implements Annotator, HighlightRangeExtension {
|
||||
@NotNull
|
||||
private static String getMessage(@NotNull Diagnostic diagnostic) {
|
||||
String message = IdeErrorMessages.RENDERER.render(diagnostic);
|
||||
if (KotlinInternalModeToggleAction.OBJECT$.isEnabled() || ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
if (KotlinInternalModeToggleAction.OBJECT$.getEnabled() || ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
String factoryName = diagnostic.getFactory().getName();
|
||||
if (message.startsWith("<html>")) {
|
||||
message = String.format("<html>[%s] %s", factoryName, message.substring("<html>".length()));
|
||||
@@ -281,7 +281,7 @@ public class JetPsiChecker implements Annotator, HighlightRangeExtension {
|
||||
@NotNull
|
||||
private static String getDefaultMessage(@NotNull Diagnostic diagnostic) {
|
||||
String message = DefaultErrorMessages.RENDERER.render(diagnostic);
|
||||
if (KotlinInternalModeToggleAction.OBJECT$.isEnabled() || ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
if (KotlinInternalModeToggleAction.OBJECT$.getEnabled() || ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
return String.format("[%s] %s", diagnostic.getFactory().getName(), message);
|
||||
}
|
||||
return message;
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.InTextDirectivesUtils;
|
||||
import org.jetbrains.jet.JetTestCaseBuilder;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.plugin.actions.internal.KotlinInternalModeToggleAction;
|
||||
import org.jetbrains.jet.plugin.references.BuiltInsReferenceResolver;
|
||||
import org.jetbrains.jet.utils.UtilsPackage;
|
||||
|
||||
@@ -47,6 +48,7 @@ public abstract class JetLightCodeInsightFixtureTestCase extends LightCodeInsigh
|
||||
super.setUp();
|
||||
((StartupManagerImpl) StartupManager.getInstance(getProject())).runPostStartupActivities();
|
||||
VfsRootAccess.allowRootAccess(JetTestCaseBuilder.getHomeDirectory());
|
||||
KotlinInternalModeToggleAction.OBJECT$.setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user