Skip to content

editor config support #8

@twelvelabs

Description

@twelvelabs

Support reading editorconfig data (if present) and make those values available to pass through to commands.

For example, many formatting tools support configuring indentation via a CLI flag. Stylist could allow for something like:

processors:
  - name: jsonfmt
    includes:
      - "**/*.{json}"
    fix:
      command: "jsonfmt --indent {{ .indent_size }}"
      input: variadic
      output: none

... where indent_size would be read from .editorconfig.

To implement:

  1. We'd need to come up w/ some rules for how we resolve editorconfig values for a given batch of paths. Theoretically you can have values defined in .editorconfig per-file, though in practice most people likely have them defined per-filetype. If we're executing a command for a batch of files, which path do we use to determine the editor config values? Personally I think just using the first file will be fine, but we'd need to validate and document that.

  2. After resolving editorconfig values, we'd need to run the command string through text/template. Might want to think about tools that don't expose flags and only support config files... maybe allow for specifying a config template that we render to /tmp and expose via a {{ .rendered_config_path }} var? Though if we want to do that, should create a separate issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions