Reputation: 47212
Right now when I press ctrl+shift+p and select format document, code gets formatted like this:
const validators: Array<
ValidationContext
> = ValidationContainer.getValidationContexts(key);
I would like it to look like this:
const validators: Array<ValidationContext> =
ValidationContainer.getValidationContexts(key);
Any ideas on what switches I can flip? I'm using the Prettier formatting extension.
Upvotes: 6
Views: 8024
Reputation: 41
Add codes below to your setting.json file:
"[typescript]": { "editor.formatOnSave": true, "editor.defaultFormatter": "esbenp.prettier-vscode" }
Upvotes: 4
Reputation: 5056
printWidth is what you search for. -> https://prettier.io/docs/en/options.html
But you will have other problems with tslint and prettier. Try a plugin like this. -> https://alexjoverm.github.io/2017/06/12/Use-Prettier-with-TSLint-and-be-happy/
Upvotes: 5