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

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki nicolasstucki requested a review from smarter June 14, 2017 08:20
Copy link
Contributor

@DarkDimius DarkDimius left a 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

@smarter
Copy link
Member

smarter commented Jun 14, 2017

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)

@smarter
Copy link
Member

smarter commented Jun 14, 2017

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?).

@nicolasstucki
Copy link
Contributor Author

that could work


val vscodeSetting = new File(".vscode/settings.json")
if(!vscodeSetting.exists()) {
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

"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

"**/*.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
Copy link
Member

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?

"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,
Copy link
Member

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.


// If .vscode does not exist yet, initialize it with the contents of .vscode-template/
val vscodeSetting = new File(".vscode/")
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 vscodeSetting = new File(".vscode/")
if(!vscodeSetting.exists()) {
vscodeSetting.mkdir()
for (file <- new File(".vscode-template/").listFiles)
Copy link
Member

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

@nicolasstucki
Copy link
Contributor Author

Fixed all comments

@felixmulder
Copy link
Contributor

@smarter - can this go in now?

@DarkDimius
Copy link
Contributor

@smarter could you please review it today so we can get it into next milestone?

@smarter
Copy link
Member

smarter commented Jul 10, 2017

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.

@nicolasstucki
Copy link
Contributor Author

As @smarter said, this is just for us. Therefore it is not a priority.

Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

"search.exclude": {
"**/*.class": true,
"**/*.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/

"**/*.class": true,
"**/*.hasTasty": true,
"**/target/**": true,
"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.

@@ -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"

@smarter smarter merged commit 5e05d3f into scala:master Jul 12, 2017
@allanrenucci allanrenucci deleted the vs-code-settings branch December 14, 2017 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants