Skip to content

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

Open
@trfv

Description

@trfv

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions