mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.49k stars 299 forks source link

Add Format Support for TSQL #1130

Open grantwforsythe opened 1 year ago

grantwforsythe commented 1 year ago

Unable to properly format TransactSQL/TSQL.

As a very basic example, see the statement below:

Starting Value

BEGIN

DECLARE @Now [datetime] = GETDATE();

IF YEAR(@Now) > 2023
    PRINT 'It is 2023!'
ELSE
    PRINT 'It is **not** 2023!'
END

Expected

BEGIN
    DECLARE @Now [datetime] = GETDATE();

    IF YEAR(@Now) > 2023
        PRINT 'It is 2023!'
    ELSE
        PRINT 'It is **not** 2023!'
END

Recieved

BEGIN
DECLARE @Now [datetime] = GETDATE();

IF YEAR(@Now) > 2023 PRINT 'It is 2023!'
ELSE PRINT 'It is **not** 2023!'
END

Additional Info

My format configuration:

  "sqltools.format": {
    "reservedWordCase": "upper",
    "linesBetweenQueries": 2
  }