Show LV=1.2 in IDE only in internal mode

This commit is contained in:
Mikhail Zarechenskiy
2017-03-28 14:10:06 +03:00
parent 5027a76ed4
commit c512453e16
4 changed files with 15 additions and 2 deletions
@@ -253,7 +253,7 @@ public abstract class CLICompiler<A extends CommonCompilerArguments> {
);
}
if (languageVersion.compareTo(LanguageVersion.LATEST_STABLE) > 0) {
if (!languageVersion.isStable()) {
configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY).report(
CompilerMessageSeverity.STRONG_WARNING,
"Language version " + languageVersion.getVersionString() + " is experimental, there are " +
@@ -83,11 +83,14 @@ enum class LanguageVersion(val major: Int, val minor: Int) : DescriptionAware {
KOTLIN_1_1(1, 1),
KOTLIN_1_2(1, 2);
val isStable: Boolean
get() = this <= LATEST_STABLE
val versionString: String
get() = "$major.$minor"
override val description: String
get() = if (this > LATEST_STABLE) "$versionString (EXPERIMENTAL)" else versionString
get() = if (isStable) versionString else "$versionString (EXPERIMENTAL)"
override fun toString() = versionString
@@ -50,6 +50,7 @@ import org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants;
import org.jetbrains.kotlin.config.*;
import org.jetbrains.kotlin.idea.KotlinBundle;
import org.jetbrains.kotlin.idea.PluginStartupComponent;
import org.jetbrains.kotlin.idea.actions.internal.KotlinInternalMode;
import org.jetbrains.kotlin.idea.facet.DescriptionListCellRenderer;
import org.jetbrains.kotlin.idea.facet.KotlinFacet;
import org.jetbrains.kotlin.idea.util.application.ApplicationUtilsKt;
@@ -334,6 +335,10 @@ public class KotlinCompilerConfigurableTab implements SearchableConfigurable, Co
@SuppressWarnings("unchecked")
private void fillLanguageAndAPIVersionList() {
for (LanguageVersion version : LanguageVersion.values()) {
if (!version.isStable() && !KotlinInternalMode.Instance.getEnabled()) {
continue;
}
languageVersionComboBox.addItem(version.getDescription());
apiVersionComboBox.addItem(version.getDescription());
}
@@ -35,6 +35,7 @@ import org.jetbrains.kotlin.config.LanguageVersion
import org.jetbrains.kotlin.diagnostics.Diagnostic
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.idea.KotlinPluginUtil
import org.jetbrains.kotlin.idea.actions.internal.KotlinInternalMode
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
import org.jetbrains.kotlin.idea.configuration.KotlinWithGradleConfigurator
import org.jetbrains.kotlin.idea.facet.KotlinFacet
@@ -146,6 +147,10 @@ sealed class EnableUnsupportedFeatureFix(
val apiVersionOnly = sinceVersion <= languageFeatureSettings.languageVersion &&
feature.sinceApiVersion > languageFeatureSettings.apiVersion
if (!sinceVersion.isStable && !KotlinInternalMode.enabled) {
return null
}
val module = ModuleUtilCore.findModuleForPsiElement(diagnostic.psiElement) ?: return null
if (KotlinPluginUtil.isMavenModule(module)) return null
if (!KotlinPluginUtil.isGradleModule(module)) {