Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VSCode settings for the dotty project #2750

Merged
merged 11 commits into from
Jul 12, 2017
21 changes: 21 additions & 0 deletions .vscode-template/settings.json
Original file line number Diff line number Diff line change
@@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to exclude **/target too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"**/*.hasTasty": true,
"**/target/**": true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this regexp should be equivalent to just target/

"scala2-library/{doc,docs,lib,META-INF,scripts,spec,test,tools}/*": true, // only allow scala-backend/src
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you end this regexp with / instead of /* ? Same for various other regexps below.

"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
}
}
8 changes: 6 additions & 2 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,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")
Expand Down Expand Up @@ -1138,7 +1138,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,
Expand All @@ -1147,6 +1147,10 @@ object Build {
| > git submodule update --init
""".stripMargin)
}

// If contents .vscode do not exist yet, initialize them with the contents of .vscode-template/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say "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
}

Expand Down