microsoft / microsoft/TypeScript
Formatter fails to format uglified files
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 1.8.10
I use vscode from the Command Palette to format a javascript file uglified by uglify-js, but it failed. It not format code correctly, and only format partially.
source file

sublime jsFormat formated

vscode formated

You see, It seems like, vscode only add some spaces around brackets, letters, commas etc.
See https://github.com/Microsoft/vscode/issues/8914#issuecomment-231978337 and the discussion below for more details. The provided traces clearly show that the tsserver only returns white space (" ") changes. No insertion of new lines.
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
Reproduce the issue by running VS Code's Command Palette formatter on JavaScript output produced by uglify-js. Start with the tsserver formatting traces referenced in the report, which show only whitespace changes; done means uglified files receive the expected line breaks and indentation rather than only spacing adjustments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100