Skip to content

Expose list of supported parsers, etc. #3023

@azz

Description

@azz

Currently every time Prettier adds another language, a lot of editor integrations have to release another version of their plugin to support it. This might be adding more language types, extensions, etc.

I'm wondering if we'd be able to support some kind of feature detection within Prettier that editor integrations can call and run more dynamically. Something along the lines of:

require('prettier').getSupportInfo();

Which might return:

{
  languages: [
    {
      language: "javascript",
      parsers: ["babylon", "flow"],
      ids: ["javascript", "javascriptreact"],
      extensions: [".js", ".jsx", ".mjs"]
    },
    {
      language: "typescript",
      parsers: ["typescript"],
      ids: ["typescript", "typescriptreact"],
      extensions: [".ts", ".tsx"]
    },
    ...
  ]
}

Would be nice to release this alongside Markdown support.

Love to get some feedback from some plugin maintainers on whether this kind of thing could be useful.

cc. @robwise @CiGit @mitermayer

Metadata

Metadata

Assignees

Labels

locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!status:needs discussionIssues needing discussion and a decision to be made before action can be takentype:editor supportIssues about tools Prettier provides for use inside editor integrations.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions