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

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

Closed
nanovak opened this issue May 23, 2024 · 11 comments
Closed

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

nanovak opened this issue May 23, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@nanovak
Copy link

nanovak commented May 23, 2024

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 rosshamish added the bug Something isn't working label May 24, 2024
@rosshamish
Copy link
Owner

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
Copy link
Author

nanovak commented May 25, 2024

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
Copy link
Owner

@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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

nanovak commented May 25, 2024

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

nanovak commented May 25, 2024

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
Copy link
Owner

rosshamish commented May 25, 2024

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//pull/127 ]

@rosshamish
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants