Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Format *.tsx files on save in VS Code

In settings.json it is possible to only format *.ts files with:

"[typescript]": {
    "editor.formatOnSave": true
}

but I can't get it to work for *.tsx files.

like image 548
David Avatar asked Apr 05 '19 14:04

David


People also ask

How do I enable format on save VS Code?

To automatically format the file on save, In Visual Studio Code, press Control + Shift + P or Command + Shift + P (Mac) to open the command palette and type setting and then select Preferences: Open User Settings option. Search for format on save setting and check the checkbox.

How do you format a document in VS Code?

VS Code has great support for source code formatting. The editor has two explicit format actions: Format Document (Ctrl+Shift+I) - Format the entire active file. Format Selection (Ctrl+K Ctrl+F) - Format the selected text.


1 Answers

"[typescriptreact]": {
    "editor.formatOnSave": true
}

See also Language specific editor settings

like image 96
David Avatar answered Sep 22 '22 12:09

David