rosshamish / kuskus

The extension pack so nice they named it twice
https://marketplace.visualstudio.com/items?itemName=rosshamish.kuskus-extensions-pack
44 stars 10 forks source link

Coloring fails to recognize escaping backslash characters from escaping other special characters #159

Closed asilverman closed 4 months ago

asilverman commented 4 months ago

Consider the following query:

let scannerId = "9d632724-5c18-43e9-9314-555e9587b30c";
cluster("foo").database("bar").table("baz")
| extend ScannerName = tostring(todynamic(Properties).scannerConfigurationName)
| where Name matches regex "Skipping comment creation for file" and Name matches regex "as the scanner rule is in silent mode"
| extend FullFileName = extract("Skipping comment creation for file (. + ) as the scanner rule is in silent mode", 1, Name)
| extend FileNameParts = split(FullFileName, "Modified\\")
| extend FileName = iff(isempty(FileNameParts[1]), FullFileName, strcat("\\", FileNameParts[1])) //FullFileName was added on 2/2/24
| extend FileName = trim("'", FileName)

Notice how the github highlighting recognizes the line | extend FileNameParts = split(FullFileName, "Modified\\") to be escaping the backslash characted being escaped. However, the kuskus extension doesn't (as shown below) image

Version Information:

image

rosshamish commented 4 months ago

Good bug, thanks for the report.

If you (or anyone reading) is willing to put a fix together, I'd be happy to facilitate. There's some good test coverage for the syntax highlighting, so it would be "as simple" as adding a new test case to cover this scenario, then updating the syntax highlighting regex to make the new test pass.

rosshamish commented 4 months ago

Found some time to look at this - fixed in #162 , published as v2.0.2 in https://github.com/rosshamish/kuskus/actions/runs/9056796653/job/24879823341

rosshamish commented 4 months ago

@asilverman please take a look and see if you can verify the fix. Thanks!

asilverman commented 4 months ago

@rosshamish Im out in vacation, I'll try to take a look at it by May 28