"Format Document" a TS file removes spaces in curly braces
See original GitHub issueTS Template added by @mjbvz
TypeScript Version: 4.1.0-dev.20201031
Search Terms
- jsx
- format
- VSCode Version: 1.50.1
- OS Version: macOS 10.14.6
Steps to Reproduce:
- Open a
.tsx
file - Write something with space inside curly braces, like below. Notice the spaces between expression and brace:
import { ExamplePane } from '../app/App';
...
return (
<div>
{ this.state.time.toLocaleTimeString() }
</div>
);
- Right click & Format Document, then it becomes:
import { ExamplePane } from '../app/App'; {/* This one is still fine */}
...
return (
<div>
{ this.state.time.toLocaleTimeString()} {/* The space before the closing curly brace is gone */}
</div>
);
Does this issue occur when all extensions are disabled?: Yes
Update: This is it:
In my project, when I use Format Document, all my files are formatted with the default option like @a-tarasyuk (spaces after opening and before closing braces are removed). Then the issue is that VSCode does not delete the space after open braces.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Visual Studio 2017 - Space before and after curly braces
However if i press Ctrl + E , Ctrl + D to format the entire document the spacing is removed. How I would...
Read more >space-in-brackets - ESLint - Pluggable JavaScript Linter
objectsInArrays sets the spacings between the curly braces and square brackets of object literals that are the first or last element in an...
Read more >Options - Prettier
Prettier ships with a handful of format options. ... See: Angular, TypeScript, Flow. ... Print spaces between brackets in object literals. Valid options:....
Read more >VS Code - You don't need a formatting extension (Prettier and ...
Use four spaces per indentation, and; Wrap all arrow functions in curly braces. All of the above are just personal preferences, but I...
Read more >How to configure Prettier and VSCode - Gleb Bahmutov
I like using JSON configuration format so my code editor helps me. In fact, VSCode understands the Prettier configuration file format via ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is the correct repo; VS Code uses the formatter in this repo to format tsx code.
Can we get a clarified repro? What are your settings? A ts server log would be ideal
The issue got transferred to the TypeScript repository by @mjbvz.