Skip to content

Add VSCode settings for the dotty project #2750

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

Merged
merged 11 commits into from
Jul 12, 2017
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ project/local-plugins.sbt
# npm
node_modules

# VS Code
.vscode/

# Scala-IDE specific
.scala_dependencies
.cache
Expand Down
File renamed without changes.
11 changes: 9 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,13 @@ object Build {
| > git submodule update --init
""".stripMargin)
}

val vscodeSetting = new File(".vscode/settings.json")
if(!vscodeSetting.exists()) {
Copy link
Member

Choose a reason for hiding this comment

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

Missing space after if

val vscodeSettingTemplate = new File(".vscode/settings-template.json")
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 use a .vscode-template directory instead:

  • We might want to add settings for other files in .vscode
  • This means that it's safe to gitignore everything in .vscode

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 also add a comment explaining what this does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea

java.nio.file.Files.copy(vscodeSettingTemplate.toPath, vscodeSetting.toPath)
}

state
}

Expand Down