Skip to content

feature request: Inherit from existing formatter #800

@ysooqe

Description

@ysooqe

Did you check existing requests?

  • I have searched the existing issues

Describe the feature

First of all, thanks for the great plugin!

It would be great if a custom formatter could "inherit" from an existing formatter, e.g. using the inherit key and instead of setting it to true or false (extenting or overwriting the formatter with the same name), it would be great if I could specify an existing formatter to inherit the entire config from so that I could create a formatter that is shared among many filetypes but has only a few settings changed or added (in my example, an additional argument for the command).
This could also be separate from the inherit config and could be called clone or something similiar.

In the end, it would be looking something like this:

formatters = {
  deno_fmt_markdown = {
    clone = 'deno_fmt',
    append_args = { '--indent-width', '4' },  
  },
}

Provide background

I have the following use case:

I am using deno_fmt for different filetypes. The default is an indent-width of 2 (for typescript, javascript, etc.) but for markdown (which it can also format), I would like to set an indent-width of 4 (which can be done with the arg --indent-width).

Unfortunately, I did not manage to find a way to configure the same formatter (slightly) differently for different filetypes.

If my use case of "same formatter for different filetypes with only slightly different options" is already covered by something else, please ignore this feature request. I would appreciate a short hint on how to achieve this though.

What is the significance of this feature?

nice to have

Additional details

No response

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