microsoft / microsoft/TypeScript
Support column limit in formatter
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Currently, running the formatter
(eg via the compiler API: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#pretty-printer-using-the-ls-formatter)
produces code which is arbitrarily wide, for statements which are nested, complex, etc.
Our style guide requires a maximum columns, which means the formatter should take a configuration for how wide this is.
Line breaks should probably be added at the highest point in the AST on the long line.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the compiler API's pretty-printer and language-service formatter documentation linked in the issue, then trace the formatter entry point and how it represents nested AST nodes. Done means the formatter accepts a maximum column width and produces line breaks for overly wide nested statements, with behavior that can be verified against representative complex code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100