typescript-formatter icon indicating copy to clipboard operation
typescript-formatter copied to clipboard

Allow usage of Language Service plugins via tsconfig.json `compilerOptions.plugins`?

Open karlhorky opened this issue 4 years ago • 0 comments
trafficstars

I would like to use typescript-formatter on the command line to call the SQL formatting functionality in typescript-sql-tagged-template-plugin (when SQL is in inline tagged template literals).

The language service plugin implements getFormattingEditsForRange, but it is not being loaded if I specify it in tsconfig.json as follows:

{
  "compilerOptions": {
    "plugins": [
      { "name": "typescript-sql-tagged-template-plugin" }
    ]
  }
}

I'm guessing because TypeScript is being imported from 'typescript', instead of 'typescript/lib/tsserverlibrary', which seems to be required for enabling plugins.

I also found a gist from @weswigham, which seems to go in this direction.

Would this use case be something possible to support here?

karlhorky avatar Jan 03 '21 16:01 karlhorky