Tom Smykowski
Tom Smykowski

Reputation: 26089

How to stop Visual Studio Code from adding a two spaces in a new line generated with a snippet?

For Angular project there is a snippet that looks like:

    "Example snippet": {
    "prefix": "example-snippet",
    "body": [
       "first line",
       "",
       "third line"
    ]
    ...

What this snippet should do is to create an empty line between first and third line. But what it does is adding a line with two spaces. Unfortunately this is against Angular Linter rules triggering:

trailing whitespace (no-trailing-whitespace)tslint(1)

Is there any way to make a new line with a snippet, but without two spaces in it?

Upvotes: 0

Views: 822

Answers (1)

C.OG
C.OG

Reputation: 6529

You can add the option to fix all tslint issues on save in your vscode settings.

Try adding this to your vscode settings:

"editor.codeActionsOnSave": {
    "source.fixAll.tslint": true,
},

This will trigger tslint to autofix the autofixable issues.

Upvotes: 2

Related Questions