Vscode-mssql: Syntax Colorizations misread CHARINDEX('\')

Created on 13 May 2020  路  8Comments  路  Source: microsoft/vscode-mssql

  • MSSQL Extension Version: 1.9.0
  • VSCode Version: 1.45.0
  • OS Version: Windows 10 Version 10.0.17134 Build 17134

Steps to Reproduce:

  1. Create text/code block to demonstrate syntax colorization
  2. Insert CHARINDEX('\') before or in the middle of the block
  3. Note that the colorizations to not consider the '\' string closed.

CHARINDEX('\') returns the correct character identifier when run but does not color accordingly in mssql.

bug

Most helpful comment

This issue is driving me nuts. Stopping me using the extension. See fix was attempted in #1630 and rolled back. Going to see if I can crack it! @abist have you made any progress on it since rollback?

All 8 comments

The text editor shows how tricky this issue is by sabotaging my text. Everywhere that it shows CHARINDEX('') should have a backslash enclosed by the single quotes.

It looks like it is treating the backslash as an escape character when a backslash is used at the end of a string.

Example using a declare:
image

Example using charindex
image

This issue is driving me nuts. Stopping me using the extension. See fix was attempted in #1630 and rolled back. Going to see if I can crack it! @abist have you made any progress on it since rollback?

@SJMakin Like you rightly pointed out, the fix was rolled out because it broke other key scenarios. I haven't worked on this since yet, but I'll make it a priority.

@abist Thanks. It is a suprisingly common occurance due to the charindex use - parsing user names for exmaple. Debugging now. Looks like your original commit wasnt far off at all. Hoping I can contribute/help :)

@abist Please can you review #1701?

@SJMakin Thanks for opening the PR! I'm going to look at it tonight and do some testing and hopefully get this shipped if it all looks good!

What happened to this? Its still breaking for me and I see there hasn't been any activity on the PR for a month....

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haydnlj picture haydnlj  路  7Comments

casraysa picture casraysa  路  7Comments

nivek7 picture nivek7  路  3Comments

Raymondd picture Raymondd  路  4Comments

GhostBasenji picture GhostBasenji  路  5Comments