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

Multi-line string literal support (recognize ```) #166

Closed nanovak closed 3 months ago

nanovak commented 3 months ago

Some of my Kusto queries leverage multi-line strings (think embedded HTML). Unfortunately, the Kusto plugin sees ``` and throws a validation error.

ASK: Please support ``` as a recognized string start/end indicator (same as ' or ").

Documentation: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string#multi-line-string-literals

rosshamish commented 3 months ago

Thanks for the report. I put in a speculative fix for this, it's published now as v2.0.3 https://marketplace.visualstudio.com/items?itemName=rosshamish.kuskus-kusto-syntax-highlighting, please update and let me know how it looks for you

nanovak commented 3 months ago

Thanks for the quick turn around! I'm still seeing the same behavior though, even after taking the update. Here's what I'm seeing... image Note these are "ticks" and not single quotes. Same key as ~

rosshamish commented 3 months ago

@nanovak Could you share the full text of that file you're working in? Or a redacted, smaller version that reproduces the issue you're seeing? I'd like to check it in as a test case and see what's going on with it

rosshamish commented 3 months ago

Oh wait, maybe I see what's going on here. The issues you're talking about come from kusto-language-server, not kusto-syntax-highlighting. There's probably a similar gap in the language server as in #167

rosshamish commented 3 months ago

Could you try updating to 3.2.0 of the language server ?

Name: [Kuskus] Kusto Language Server Id: rosshamish.kuskus-kusto-language-server Description: Language server for the Kusto query language Version: 3.2.0 Publisher: rosshamish VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=rosshamish.kuskus-kusto-language-server

nanovak commented 3 months ago

When I looked this evening, VS Code signaled there was an update for both the Language Server and the Syntax Highlighting so I grabbed both. Sorry, I should have shared that earlier. I'm on v3.2.0 of the language server, and v2.0.3 of the syntax highlighting.

Here's what the code looks like (edited a bit to obfuscate what I'm working on). I'm using the multi-line string because I'm embedding html code into the mix and that includes it's own double quotes (") in the href. EvidenceLink is the name of another string element defined earlier in the query and used inside the html block, so you see why the ``` is needed on the line that starts with 1. Review...

| extend RemediationSteps = strcat(
```<b>Remediate these issues within 7 days to prevent another alert.</b><br>
1. Review your <b><a href="```, EvidenceLink, ```" target="_blank">KPI Dashboard</a></b><br>.
2. Fix the issues shown<br>
```)
| extend Keywords = strcat(QueryId,'foo')
rosshamish commented 3 months ago

I'm suspicious it's some stale process, could you try reloading the extension and restarting vs code if necessary also?

I see this on 3.2.0 with that block and with diagnostics enabled in the extension's settings, in a github codespace

image
rosshamish commented 3 months ago

I do see this broken in my environment on at least one older version, not sure when it first broke or was fixed though

nanovak commented 3 months ago

I figured out what the additional problem was, after removing and reinstalling these plugins, plus even a PC reboot (hey it's Windows, you never know). I had "Kusto Notebooks" installed too (https://marketplace.visualstudio.com/items?itemName=donjayamanne.kusto), and when I disabled that the errors went away.

Thanks so much for your diligence in not just fixing the plugin at hand, but helping me to debug this!

rosshamish commented 3 months ago

You're welcome! I suspect they might have the same bug as this project did. That's a neat extension though.

[Edit: after looking, it's actually the exact same, they have a stale version of the Kusto library checked into their source tree https://github.com/notebookPowerTools/vscode-kusto/tree/main/libs/kusto/min . The fix in this repo was mostly in #127 https://github.com/rosshamish/kuskus/pull/127 ]

rosshamish commented 3 months ago

Closing for now, let me know if you notice other bugs