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.56k stars 898 forks source link

SQLCMD statments flagged as errors even when in SQLCMD mode #17691

Closed gbritton1 closed 2 years ago

gbritton1 commented 2 years ago

Issue Type: Bug

I have a working SQLCMD file. My editor is set in SQLCMD mode (I know since the option at the top of the tab has a button to "Disable SQLCMD")

Even so, my valid SQLCMD statements are flagged as errors. e.g.

:setvar foo "bar"

is flagged with the error message "Incorrect syntax near ':'.",

Note: this often happens after changing my connection. Also, toggling the disable/enable sqlcmd button usually removes the error message

Azure Data Studio version: azuredatastudio 1.33.1 (0b9ef714c823d662815f441aec4a94eaa21940f8, 2021-11-04T17:45:15.872Z) OS version: Windows_NT x64 10.0.19042 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (8 x 2112)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.88GB (1.85GB free)| |Process Argv|| |Screen Reader|no| |VM|0%|
Extensions (3) Extension|Author (truncated)|Version ---|---|--- azuredatastudio-postgresql|Mic|0.2.7 import|Mic|1.5.0 powershell|ms-|2021.8.2
gbritton1 commented 2 years ago

Screen shot:

image

Charles-Gagnon commented 2 years ago

@llali Aren't we supposed to be disabling the language parsing when in sqlcmd mode?

llali commented 2 years ago

@Charles-Gagnon I don't think I worked on this feature before and I don't have any idea how it should work.

gbritton1 commented 2 years ago

I don't think you should disable language parsing. rather, you should also accept SQLCMD syntax as well as T-SQL

alanrenmsft commented 2 years ago

@kisantia is this something that was assigned to you by Udeesha?

kisantia commented 2 years ago

@alanrenmsft Udeesha added this a couple years ago, but I also haven't worked on this feature before.