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

VSCode integration with --header-opt-out #354

Closed
matthewford opened this issue Nov 10, 2022 · 11 comments · Fixed by #357
Closed

VSCode integration with --header-opt-out #354

matthewford opened this issue Nov 10, 2022 · 11 comments · Fixed by #357

Comments

@matthewford
Copy link

Hi, I would like to use the opt-out argument to aid the adoption on a complex project.

However, it looks like the VSCode extension does not support additional arguments. Would it be possible to make --header-opt-out a default setting?

@reese
Copy link
Collaborator

reese commented Nov 13, 2022

I think I'd be okay with making the header-opt-out functionality a default (other code formatters also have something like this by default, e.g. // prettier-ignore), as long as we still had the reverse (like --no-header-opt-out or whatever). PRs would be welcome here!

@fables-tales
Copy link
Owner

fables-tales commented Nov 13, 2022

@reese let's add a ~/.rubyfmtrc and $(pwd)/.rubyfmtrc that passes flags in? I think the VS code extension runs rubyfmt from $(pwd) so that should work just fine?

we should not pass the opt out by default

@fables-tales
Copy link
Owner

oh and XDG_CONFIG_HOME

@reese
Copy link
Collaborator

reese commented Nov 13, 2022

I think an rc file would be fine, I guess my main concern there is just adding more complexity (e.g. is there a world where we need to support ENV variables when reading the rc file, we probably now need to handle how precedence works if the system file and pwd file conflict, etc.)

@fables-tales
Copy link
Owner

I buy that, maybe the right thing to do is instead have folks build a wrapper shell script that passes the flags they want?

@fables-tales
Copy link
Owner

i.e. your/project/rubyfmt

#!/bin/bash
rubyfmt --flags --you --care --about $*

@reese
Copy link
Collaborator

reese commented Nov 13, 2022

Yeah, the wrapper script is the way we did it (and still do it) for the Stripe rollout. I don't think it's a perfect end state, but I think it's good enough for most cases at the moment, especially since we have pretty few flags at the moment.

@fables-tales
Copy link
Owner

@matthewford does the suggestion of using a wrapper script meet your needs here?

@reese
Copy link
Collaborator

reese commented Nov 13, 2022

Just as another option for this particular case, I don't know if we ever documented it (although we should), but there's some support for a .rubyfmtignore file where you could add globs/directories you haven't rolled out to yet, that could be a good option if you're using this for a rollout.

@fables-tales
Copy link
Owner

@reese oh, let's document that

@matthewford
Copy link
Author

A wrapper works, rubyfmtignore would be really useful too

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 a pull request may close this issue.

3 participants