Browse files

enable type-aware highlighting by default

  • Loading branch information...
1 parent e805f3d commit cca7343c881a4804c3ef6526ab412e6171c1ea17 @jozic jozic committed with Mikko Peltonen Aug 24, 2012
View
20 src/main/scala/org/sbtidea/IdeaProjectDescriptor.scala
@@ -129,7 +129,8 @@ class IdeaProjectDescriptor(val projectInfo: IdeaProjectInfo, val env: IdeaProje
"vcs.xml" -> Some(project(vcsComponent)),
"projectCodeStyle.xml" -> Some(defaultProjectCodeStyleXml),
"encodings.xml" -> Some(defaultEncodingsXml),
- "scala_compiler.xml" -> (if (env.useProjectFsc) Some(scalaCompilerXml) else None)
+ "scala_compiler.xml" -> (if (env.useProjectFsc) Some(scalaCompilerXml) else None),
+ "highlighting.xml" -> (if (env.enableTypeHighlighting) Some(highlightingXml) else None)
) foreach {
case (fileName, Some(xmlNode)) if (!configFile(fileName).exists) => saveFile(configDir, fileName, xmlNode)
case _ =>
@@ -147,15 +148,22 @@ class IdeaProjectDescriptor(val projectInfo: IdeaProjectInfo, val env: IdeaProje
} else log.error("Skipping .idea creation for " + projectInfo.baseDir + " since directory does not exist")
}
- val scalaCompilerXml = {
+ val scalaCompilerXml =
<project version="4">
<component name="ScalacSettings">
- <option name="COMPILER_LIBRARY_NAME" value={projectInfo.childProjects.headOption.
- map(p => SbtIdeaModuleMapping.toIdeaLib(p.scalaInstance).name).getOrElse("")}/>
- <option name="COMPILER_LIBRARY_LEVEL" value="Project"/>
+ <option name="COMPILER_LIBRARY_NAME" value={projectInfo.childProjects.headOption.
+ map(p => SbtIdeaModuleMapping.toIdeaLib(p.scalaInstance).name).getOrElse("")}/>
+ <option name="COMPILER_LIBRARY_LEVEL" value="Project"/>
+ </component>
+ </project>
+
+ val highlightingXml =
+ <project version="4">
+ <component name="HighlightingAdvisor">
+ <option name="SUGGEST_TYPE_AWARE_HIGHLIGHTING" value="false"/>
+ <option name="TYPE_AWARE_HIGHLIGHTING_ENABLED" value="true"/>
</component>
</project>
- }
val defaultProjectCodeStyleXml =
<project version="4">
View
3 src/main/scala/org/sbtidea/IdeaProjectDomain.scala
@@ -39,4 +39,5 @@ case class IdeaUserEnvironment(webFacet: Boolean)
case class IdeaProjectEnvironment(projectJdkName :String, javaLanguageLevel: String,
includeSbtProjectDefinitionModule: Boolean, projectOutputPath: Option[String],
- excludedFolders: String, compileWithIdea: Boolean, modulePath: String, useProjectFsc: Boolean)
+ excludedFolders: String, compileWithIdea: Boolean, modulePath: String, useProjectFsc: Boolean,
+ enableTypeHighlighting: Boolean)
View
6 src/main/scala/org/sbtidea/SbtIdeaPlugin.scala
@@ -34,8 +34,9 @@ object SbtIdeaPlugin extends Plugin {
private val NoClassifiers = "no-classifiers"
private val SbtClassifiers = "sbt-classifiers"
private val NoFsc = "no-fsc"
+ private val NoTypeHighlighting = "no-type-highlighting"
- private val args = (Space ~> NoClassifiers | Space ~> SbtClassifiers | Space ~> NoFsc).*
+ private val args = (Space ~> NoClassifiers | Space ~> SbtClassifiers | Space ~> NoFsc | Space ~> NoTypeHighlighting).*
private lazy val ideaCommand = Command("gen-idea")(_ => args)(doCommand)
@@ -91,7 +92,8 @@ object SbtIdeaPlugin extends Plugin {
val env = IdeaProjectEnvironment(projectJdkName = SystemProps.jdkName, javaLanguageLevel = SystemProps.languageLevel,
includeSbtProjectDefinitionModule = true, projectOutputPath = None, excludedFolders = "target",
- compileWithIdea = false, modulePath = ".idea_modules", useProjectFsc = !args.contains(NoFsc))
+ compileWithIdea = false, modulePath = ".idea_modules", useProjectFsc = !args.contains(NoFsc),
+ enableTypeHighlighting = !args.contains(NoTypeHighlighting))
val userEnv = IdeaUserEnvironment(false)
View
6 src/sbt-test/sbt-idea/simple-project/.idea/highlighting.xml.expected
@@ -0,0 +1,6 @@
+<project version="4">
+ <component name="HighlightingAdvisor">
+ <option name="SUGGEST_TYPE_AWARE_HIGHLIGHTING" value="false"/>
+ <option name="TYPE_AWARE_HIGHLIGHTING_ENABLED" value="true"/>
+ </component>
+</project>

0 comments on commit cca7343

Please sign in to comment.