AJP
AJP

Reputation: 28463

Stop Visual Studio Code from automatically adding semicolons and single quotes in .ts files

Related to this question but different as for .ts files. When using the QuickFix function to add a missing import I want it to use double quotes and stop it from ending with a semicolon to remain consistent with the existing code base.

I have disabled all extensions so I think this must be the built in Typescript formatting. I have tried looking through the visual studio code base and not found where this is being done yet.

Perhaps it is not possible to configure this using some setting in the preferences file?

Upvotes: 4

Views: 1810

Answers (2)

Mark
Mark

Reputation: 181060

Try these new settings (v1.41):

javascript.format.semicolons

typescript.format.semicolons

See https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_41.md#semicolon-formatter-options-for-javascript-and-typescript

Options are:

  • ignore — Does not add or remove semicolons (default).
  • insert — Insets semicolons at statement ends.
  • remove — Remove unnecessary semicolons.

Upvotes: 3

AJP
AJP

Reputation: 28463

Add "typescript.preferences.quoteStyle": "double", to your settings.json file for defaulting to double quotes.

Don't have a solution yet for not automatically inserting semicolon.

Upvotes: 0

Related Questions