microsoft / azuredatastudio

Azure Data Studio is a data management and development tool with connectivity to popular cloud and on-premises databases. Azure Data Studio supports Windows, macOS, and Linux, with immediate capability to connect to Azure SQL and SQL Server. Browse the extension library for more database support options including MySQL, PostgreSQL, and MongoDB.
https://learn.microsoft.com/sql/azure-data-studio
MIT License
7.52k stars 893 forks source link

SQLCMD syntax broken by Format On Save checked #23186

Open reavill-d opened 1 year ago

reavill-d commented 1 year ago

Issue Type: Bug

(Indentation removed for readability) This:

SET @startdate = DATEADD(D, CASE WHEN $(days) > 0 THEN 0 ELSE $(days) END, @startdate)

Becomes this after saving file: SET @startdate = DATEADD(D, CASE WHEN $(days) > 0 THEN 0 ELSE $ (days) END , @startdate)

The CRLF inserted following the dollar sign is the issue. It is a SQLCMD variable value reference

Azure Data Studio version: azuredatastudio 1.43.0 (b790d700898b1095d83e62f0de14678a58222520, 2023-04-10T23:14:27.236Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No Preview Features: Enabled

Extensions (16) Extension|Author (truncated)|Version ---|---|--- admin-pack|Mic|0.0.2 admin-tool-ext-win|Mic|0.1.2 agent|Mic|0.49.0 azcli|Mic|1.8.0 azure-cosmosdb-ads-extension|Mic|0.3.3 dacpac|Mic|1.13.0 import|Mic|1.5.4 kusto|Mic|0.5.8 managed-instance-dashboard|Mic|0.4.2 powershell|ms-|2022.7.2 profiler|Mic|0.12.2 schema-compare|Mic|1.18.0 server-report|Mic|0.2.4 sql-database-projects|Mic|1.0.1 whoisactive|Mic|0.1.5 vscodeintellicode|Vis|1.2.1
alanrenmsft commented 1 year ago

@Charles-Gagnon FYI