How to add ident to a block without reidenting it in Visual Studio Code

2

If I had a typescript file idented by 4 spaces with some SQL strings idented with 2 spaces.

function ts_query(){
    const sql=`
      SELECT *
        FROM table1
        WHERE field1 IS NULL
          AND field2 IS NOT NULL
    `;
    return sql;
}
function other(x:string){
    if(x=="this"){
        return "that";
    }
}

When I select the SQL part and press tab the conent is reidented

reident

In the picture you can see that Visual Code is not respecting my original ident of that code section.

Is there a way to configure VisualStudioCode to do the same that Notepad++ does (i.e.: respecting the original format simply adding 4 spaces).

My settings.json is:

{
    "workbench.colorTheme": "Default Light+",
    "git.autofetch": true,
    "window.zoomLevel": 0,
    "extensions.ignoreRecommendations": false,
    "git.enableSmartCommit": false,
    "git.promptToSaveFilesBeforeCommit": true,
    "window.titleBarStyle": "custom",
    "breadcrumbs.enabled": true,
    "editor.autoIndent": false
} 

I am using Visual Studio Code v1.28.2 in Windows 8.1

Emilio Platzer

Posted 2018-11-06T20:52:54.383

Reputation: 1 017

Open settings with Ctrl + comma, search Editor: Insert spaces settings, then check the box to enable. – Biswapriyo – 2019-01-16T17:58:06.133

@Biswapriyo Do you try it? It does not works. I try it right now. – Emilio Platzer – 2019-01-16T19:49:36.873

I'm using it...... OK, there also other settings. 1. set "editor.tabSize": 4 2. enable "editor.detectIndentation": true 3. enable "editor.autoIndent": true. – Biswapriyo – 2019-01-16T20:10:04.367

After you press the tab key the word FROM still only 2 spaces righter than SELECT word?. In the original text FROM is 2 spaces rigther, then when I press tab the FROM word earns 2 more spaces. – Emilio Platzer – 2019-01-16T20:12:30.950

Oooo... That one. It maybe by-design issue.Notepad++ and VSCode uses different modules for syntax. – Biswapriyo – 2019-01-16T20:35:18.393

No answers