-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure this doesn't break "git diff" if local settings are customized
I think it would break it (unless you use git update-index --assume-unchanged: http://gitready.com/intermediate/2009/02/18/temporarily-ignoring-files.html), but on the other hand, this appears to be a common things that people do, vscode itself defines settings that way: https://github.com/Microsoft/vscode/blob/master/.vscode/settings.json. So I assume that it's not common to want custom settings for one project, though someone asked for a "settings.local.json" before: microsoft/vscode#17634 (comment) |
one option would be to do as the comment I linked to suggest, have a .vscode-template automatically copied to .vscode on first run (by sbt?). |
that could work |
project/Build.scala
Outdated
|
||
val vscodeSetting = new File(".vscode/settings.json") | ||
if(!vscodeSetting.exists()) { | ||
val vscodeSettingTemplate = new File(".vscode/settings-template.json") |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea
"files.trimTrailingWhitespace": true, | ||
|
||
"search.exclude": { | ||
"**/*.class": true, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
.vscode-template/settings.json
Outdated
"**/*.class": true, | ||
"**/*.hasTasty": 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need two*
here?
.vscode-template/settings.json
Outdated
"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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for **
at the end since we're ignoring the whole folder.
project/Build.scala
Outdated
|
||
// If .vscode does not exist yet, initialize it with the contents of .vscode-template/ | ||
val vscodeSetting = new File(".vscode/") | ||
if(!vscodeSetting.exists()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after if
project/Build.scala
Outdated
val vscodeSetting = new File(".vscode/") | ||
if(!vscodeSetting.exists()) { | ||
vscodeSetting.mkdir() | ||
for (file <- new File(".vscode-template/").listFiles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use sbt.IO.copyDirectory
Fixed all comments |
@smarter - can this go in now? |
@smarter could you please review it today so we can get it into next milestone? |
Sure, but note that this only affects users of the dotty repo, it changes nothing for end users, so it doesn't really matter whether it gets in or not. |
As @smarter said, this is just for us. Therefore it is not a priority. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
.vscode-template/settings.json
Outdated
"search.exclude": { | ||
"**/*.class": true, | ||
"**/*.hasTasty": true, | ||
"**/target/**": true, |
There was a problem hiding this comment.
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/
.vscode-template/settings.json
Outdated
"**/*.class": true, | ||
"**/*.hasTasty": true, | ||
"**/target/**": true, | ||
"scala2-library/{doc,docs,lib,META-INF,scripts,spec,test,tools}/*": true, // only allow scala-backend/src |
There was a problem hiding this comment.
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.
project/Build.scala
Outdated
@@ -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/ |
There was a problem hiding this comment.
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"
No description provided.