Skip to content

feature request: option to choose formatter for the same filetype #697

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

Closed
1 task done
swann-castel opened this issue Apr 25, 2025 · 2 comments
Closed
1 task done
Labels
enhancement New feature or request

Comments

@swann-castel
Copy link

Did you check existing requests?

  • I have searched the existing issues

Describe the feature

I've added this config in formatters_by_ft = { typescript = { "biome-check", "prettierd" } } with stop_after_first = true in default_format_opts.

I would like something to trigger biome formatting only when biome.json is found, same for prettier with a .prettierrc file.

My use case is that I have several projects, some already migrated to biome, some still using prettier.

Provide background

No response

What is the significance of this feature?

strongly desired

Additional details

No response

@swann-castel swann-castel added the enhancement New feature or request label Apr 25, 2025
@scallaway
Copy link

I thought there was an option to use require_cwd, but I couldn't seem to get that to work. We're currently in the middle of a ESLint+Prettier to Biome migration and being able to run Prettier in some directories and Biome in others would be really awesome.

@stevearc
Copy link
Owner

Adding require_cwd = true to the biome-check formatter should work. If it doesn't, please file a bug with a repro.

You do always have the option to define the formatters as a function

formatters_by_ft = {
  typescript = function(bufnr)
    -- some logic
    return { "biome-check" }
  end
}

You can put whatever checks and logic you want in that function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants