Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape character misinterpreted within string literal #26159

Open
h-rdcoded opened this issue Jan 22, 2025 · 4 comments
Open

Escape character misinterpreted within string literal #26159

h-rdcoded opened this issue Jan 22, 2025 · 4 comments

Comments

@h-rdcoded
Copy link

h-rdcoded commented Jan 22, 2025

Type: Bug

Found in T-SQL. When a backslash is the final character in a string literal, the colour formatting ignores the closing quote, which then impacts the formatting in the rest of the SQL script.

Example to recreate:

DECLARE @Login VARCHAR(10) = REPLACE(REPLACE(ORIGINAL_LOGIN(),'OURDOMAIN\',''),'@ourdomain.onmicrosoft.com','')

This is like the polar opposite of the earlier issue #17894.

Azure Data Studio version: azuredatastudio 1.50.0 (49c73a8, 2024-11-17T22:41:05.327Z)
OS version: Windows_NT x64 10.0.26100
Restricted Mode: No
Preview Features: Enabled
Modes:

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i7-1260P (16 x 2496)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.64GB (16.80GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (21)
Extension Author (truncated) Version
copilot Git 1.242.0
admin-pack Mic 0.0.2
agent Mic 0.49.0
azuredatastudio-mysql Mic 1.0.0
azuredatastudio-postgresql Mic 0.6.0
azuremonitor Mic 0.1.9
dacpac Mic 1.14.0
import Mic 1.6.1
kusto Mic 0.5.8
managed-instance-dashboard Mic 0.4.3
profiler Mic 0.14.0
query-history Mic 0.5.3
schema-compare Mic 1.21.0
server-report Mic 0.2.4
sql-assessment Mic 0.6.4
sql-database-projects Mic 1.4.5
sql-dw Mic 0.0.1
whoisactive Mic 0.1.5
sql-prompt Red 0.2.15
vscodeintellicode Vis 1.3.1
poor-sql-formatter WSR 0.2.0

(1 theme extensions excluded)

@kburtram
Copy link
Member

Thanks for reporting this issue! I tried the provided example and also tested with a string that has a trailing backslash, but I couldn’t identify the specific problem you’re encountering. Could you clarify what issue you’re seeing?

Image

@h-rdcoded
Copy link
Author

Sorry, but GitHub is hiding the backslash when it renders the text in my original issue post. Here's an image to show the issue:

Image

@h-rdcoded
Copy link
Author

There was an identical issue logged and closed, in 2020, which suggested this CHAR(92) workaround. This is fine for my ad hoc use case, but only avoids the issue...

Image

I dug around to see if this issue was ever resolved, but couldn't find anything.

@kburtram
Copy link
Member

I'm not hitting this behavior with the default MSSQL colorization configuration. But I did see this bug when I install the MySQL extension, which it appears from the initial issue report that you may have that installed. If you're not actively using MySQL extension you may consider disabling/uninstalling to see if that helps resolve this issue for you.

Here's what I'm seeing with the SQL snippet.

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants