The snippets provided by the extension are formatted differently than the formatter formats. I also think the formatting in this case makes no sense.
Formatter Settings
default
Input Text - place unformatted SQL below
sqlCreateDataBase
-- Create a new database called 'DatabaseName'
-- Connect to the 'master' database to run this snippet
USE master
GO
-- Create the new database if it does not exist already
IF NOT EXISTS (
SELECT name
FROM sys.databases
WHERE name = N'DatabaseName'
)
CREATE DATABASE DatabaseName
GO
Actual Output - place formatted SQL (that doesn't work as expected) below
-- Create a new database called 'DatabaseName'
-- Connect to the 'master' database to run this snippet
USE master
GO
-- Create the new database if it does not exist already
IF NOT EXISTS (
SELECT name
FROM sys.databases
WHERE name = N'DatabaseName'
)
CREATE DATABASE DatabaseName
GO
Expected Output - place formatted SQL as you'd expect it to look below
-- Create a new database called 'DatabaseName'
-- Connect to the 'master' database to run this snippet
USE master
GO
-- Create the new database if it does not exist already
IF NOT EXISTS (
SELECT name
FROM sys.databases
WHERE name = N'DatabaseName'
)
CREATE DATABASE DatabaseName
GO
This is also described in #1800 but here you can see that the formatting in the snippet is actually sensible therefore there really is a mistake with subqueries and not an indentation preference
Problem Summary
The snippets provided by the extension are formatted differently than the formatter formats. I also think the formatting in this case makes no sense.
Formatter Settings
Input Text - place unformatted SQL below
sqlCreateDataBase
Actual Output - place formatted SQL (that doesn't work as expected) below
Expected Output - place formatted SQL as you'd expect it to look below