diff --git a/.vscode-template/settings.json b/.vscode-template/settings.json new file mode 100644 index 000000000000..725c6df5ca48 --- /dev/null +++ b/.vscode-template/settings.json @@ -0,0 +1,21 @@ +// Place your settings in this file to overwrite default and user settings. +{ + "editor.tabSize": 2, + "editor.insertSpaces": true, + + "files.trimTrailingWhitespace": true, + + "search.exclude": { + "**/*.class": true, + "**/*.hasTasty": true, + "**/target/": true, + "scala2-library/{doc,docs,lib,META-INF,scripts,spec,test,tools}/": true, // only allow scala-backend/src + "scala2-library/src/[abcefimprs]*": true, // only allow scala-backend/src/library + "scala-backend/{doc,docs,lib,META-INF,scripts,spec,test,tools}/": true, // only allow scala-backend/src + "scala-backend/src/[abefilmprs]*": true, // only allow scala-backend/src/compiler + "scala-backend/src/scala/reflect/": true, + "scala-backend/src/scala/tools/{ant,cmd,reflect,util}*": true, + "scala-backend/src/scala/tools/nsc/*.scala": true, + "scala-backend/src/scala/tools/nsc/[aijrstu]*": true // only allow scala-backend/src/scala/tools/nsc/backend + } +} diff --git a/project/Build.scala b/project/Build.scala index 9f94587fffbb..507b30d8abf1 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -262,7 +262,7 @@ object Build { settings(commonNonBootstrappedSettings). settings( triggeredMessage in ThisBuild := Watched.clearWhenTriggered, - submoduleChecks, + dottyProjectFolderChecks, addCommandAlias("run", "dotty-compiler/run") ++ addCommandAlias("legacyTests", "dotty-compiler/testOnly dotc.tests") @@ -1115,7 +1115,7 @@ object Build { )) } - lazy val submoduleChecks = onLoad in Global := (onLoad in Global).value andThen { state => + lazy val dottyProjectFolderChecks = onLoad in Global := (onLoad in Global).value andThen { state => val submodules = List(new File("scala-backend"), new File("scala2-library"), new File("collection-strawman")) if (!submodules.forall(f => f.exists && f.listFiles().nonEmpty)) { sLog.value.log(Level.Error, @@ -1124,6 +1124,10 @@ object Build { | > git submodule update --init """.stripMargin) } + + // Copy default configuration from .vscode-template/ unless configuration files already exist in .vscode/ + sbt.IO.copyDirectory(new File(".vscode-template/"), new File(".vscode/"), overwrite = false) + state }