Skip to content

[Bug]: Bad formatting with complex multiline text #22529

Description

@absgrlyp

Description

The following T-SQL Code cause MSSQL extension to format SQL in bad way.

SET @SQL = 'if not exists(select 1 from sys.server_principals p with (nolock) where name = ''ABS' + @AssigneeName + ''')
begin
create login [DOMAIN' + @AssigneeName + '] FROM WINDOWS
EXEC sp_addsrvrolemember ''ABS' + @AssigneeName + ''', ''sysadmin''
end';

Image

Steps to Reproduce

Just paste the problematic SQL to new T-SQL query file in VS Code

Affected Area

  • Connection dialog (SQL Server | Azure browse/Fabric browse)
  • Query editor
  • Query results panel
  • Object Explorer
  • GitHub Copilot integration
  • Preview/Edit data
  • Table Designer
  • Schema Designer
  • Schema Compare
  • Local SQL Server Container provisioning
  • SQL database in Fabric provisioning
  • DACPAC/BACPAC export/import
  • SQL Database projects
  • Query Plan Visualizer
  • Other (please describe below)

If you selected "Other", please describe the affected area

No response

Environment Information

VS Code: 1.130
MSSQL Extension: 1.44
OS: Windows 11 26200.8875

Confirmation

  • I have searched existing issues and couldn't find a match
  • I want to work on this issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions