Skip to content

Add support for .streerc loading to enhance SyntaxTree::Formatter.format invocation from within a Ruby script #507

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

Open
trfv opened this issue Apr 17, 2025 · 0 comments

Comments

@trfv
Copy link

trfv commented Apr 17, 2025

Hello,

I want to extend my appreciation for providing such an excellent library. At present, I'm leveraging SyntaxTree::Formatter.format from within a Ruby script, and I've noticed an area where I believe we could enhance user experience - particularly concerning the loading of the .streerc configuration file.

Here's a typical use case:

require 'syntax_tree'
tree = SyntaxTree.parse('(code here)')
puts SyntaxTree::Formatter.format(tree)

As it stands, we need to manually apply the settings stated in this configuration file for every script - which can become quite cumbersome. My proposal is to add a feature that permits the automatic loading and application of a .streerc configurations within SyntaxTree::Formatter.format.

Recently, there has been a pull request (#125) that added this feature for CLI usage, it would be highly beneficial to extend this feature to script usage as well.

Moreover, after reviewing the current Formatter.rb, it seems the formatting class does not have an interface or method for loading a .streerc file, reinforcing the need for this feature.

The new feature would allow us to centralize formatting settings and share them across our scripts, creating a more efficient workflow.

Although I understand that you may be busy, any insights or thoughts about this proposal or its feasibility would be much appreciated.

Thank you for your time and ongoing support.

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

No branches or pull requests

1 participant