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

Feature request: Default config somewhere that gets copied when scalafmt is run without a config #1299

Closed
sorenbug opened this Issue Oct 20, 2018 · 6 comments

Comments

3 participants
@sorenbug
Copy link

sorenbug commented Oct 20, 2018

This would make it a lot easier to

  1. standardize configurations between multiple projects without manually copying
  2. provide easy integration for dotfile managers

I didn't see anything in the guidelines that specified where feature requests should go, so I made an issue here.

@olafurpg

This comment has been minimized.

Copy link
Member

olafurpg commented Nov 8, 2018

Thanks for reporting! Can you please include more information? People use scalafmt via multiple integrations (cli, sbt, intellij, vscode, pants, maven, gradle, ...).

I think this sort of functionality is better suited in the build tool like is documented here https://scalameta.org/scalafmt/docs/installation.html#share-configuration-between-builds If the config doesn't exist, you can copy the default value from somewhere (which can come from the internet or home directory or wherever makes sense to to). The PR #1293 was closed for the same reason, the build tool is a better place to manage these conventions.

@sorenbug

This comment has been minimized.

Copy link

sorenbug commented Nov 8, 2018

I use scalafmt via the CLI and IntelliJ. I do currently have a csf alias in my ZSH that copies a default scalafmt file in my home directory. The reason I'm looking for a default config feature is so that if I want to have my scalafmt the same on a different computer and not the same ZSH setup, I don't have to resetup an alias (and run csf every new project).

@jozic

This comment has been minimized.

Copy link
Contributor

jozic commented Nov 23, 2018

@sorenbug
I had similar issue and managed to get good enough results using git submodule
you can read more about here https://daodecode.com/2018/11/23/share-scalafmt-configuration-with-git-submodules/

@sorenbug

This comment has been minimized.

Copy link

sorenbug commented Nov 24, 2018

@jozic That's really close to what I want, except the differences are:

  • There's manual setup involved (changing the build directory and adding the submodule)
  • It is for the maven plugin and not the CLI
@jozic

This comment has been minimized.

Copy link
Contributor

jozic commented Nov 24, 2018

@sorenbug it is actually build tool agnostic and in my article I provide setup for both sbt and maven. Don't see why CLI would not work with it. But manual step is indeed there, but it's a one time thing. For new projects you have to setup scalafmt anyway, so you can set it up this way from beginning

But I understand it may not work for everyone

@olafurpg

This comment has been minimized.

Copy link
Member

olafurpg commented Dec 30, 2018

Thanks for reporting @sorenbug ! I am afraid this functionality is better left to a separate tool than scalafmt. Closing as wontfix.

@olafurpg olafurpg closed this Dec 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment