Microsoft/monaco-editor

[Feature Request] Expose TypeScript formatting options

Open

#4067 opened on Jul 9, 2023

View on GitHub
 (2 comments) (1 reaction) (0 assignees)JavaScript (14,836 stars) (1,283 forks)batch import
feature-requesthelp wantedtypescript

Description

Context

  • This issue is not a bug report. (please use a different template for reporting a bug)
  • This issue is not a duplicate of an existing issue. (please use the search to find existing issues)

Description

Currently, the formatting options for TypeScript/JavaScript are hardcoded unlike those for HTML and CSS. Exposing these options has already been requested in #88, although I'm opening a new issue as the old one is locked.

I don't necessarily expect the feature to be implemented by anyone but myself, so I'm fine looking into doing it. I do want to know beforehand whether it even makes sense to spend time doing it, though.

And how should the new API look? I see two main possibilities:

  1. All the existing options as well as the formatting options are put into an Options interface, similar to how HTML and CSS do it. The old properties would then be depracated and changed to simply access the new options.
  2. A new interface is added called something like TSFormattingOptions and the existing ones are left as is.

I personally think option 1 is nicer and brings the API more in line with HTML and CSS, but does require deprecations in the API.

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

Contributor guide