Formatting
Flowless, easy and automatic formatting experience is key to a great IDE experience and one that is highly supported by the TypeScript compiler.
When you run the Editor: Format Code
command (Ctrl|⌘ + Alt| + L
) formatting occurs on any selected text (if any) or the entire code file.
- Selected text
- Whole file
Configuration
Formatting options are configured using .editorconfig
(general editor options) + tsconfig.json
's formatCodeOptions
(TypeScript specific options).
Auto indent
Auto indenting TypeScript is also driven by the compiler code instead of brittle regexes. It happens automatically on enter
Auto format
Not only does indentation happen automatically. Formatting also happens automatically on enter
;
}
. Trye and spot all the times the code is automatically getting formatted in the gif below