Closed AleksandrGontcharovMS closed 6 months ago
Hello! Good bug, thanks for reporting. I'm not actively maintains this extension much anymore but I am available for code review and deployments if you (or anyone else reading this) is interested in taking a shot at fixing this.
This functionality is in the language server extension. I'd expect step 1 would be to un-fork the kusto language npm package, which we checked directly into the git repo during the original hackathon that this extension pack was written during. I can't remember exactly why we needed to fork - maybe type incompatibility? Or some kind of runtime crash? But that would be the first step I'd recommend, is to "git rm" that directory and reinstall the latest stable version of it. From there, this bug might just be fixed already honestly -- especially if youre seeing the expected behaviour in the desktop and web apps, which I assume use the latest stable version.
Oh actually - we left a md file behind with some notes about this. It refers to some files in the out dir, that must be what I'm remembering.
kusto-language-server/JANK_CLEANUP.md
FYI, I had some free time and decided to take a stab at this. It turns out some of the "jank" was documented way back as bug #5 -- I'm working in PR #127.
I tested your scenario with my changes, and the results seem good. I don't love the indentation of the union in the final line, but at least it's not changing the syntax anymore. I'd be interested to hear your thoughts @AleksandrGontcharovMS - I'll wait a few days to hear back before I land the changes. I have to fix some issues in CI anyway. [Edit: got the CI passing, so I'll merge as-is. Please comment back with your thoughts still though, especially if you update your extension and see the fix on your end]
raw (as in your repro here)
let query = (kustotable:string) {
cluster(kustotable).database("DBName").TableName
| where PreciseTimeStamp > _startTime and PreciseTimeStamp < _endTime
};
let actual = query("var1")
| union query("var2");
formatted (with the changes in #127)
let query = (kustotable: string)
{
cluster(kustotable).database("DBName").TableName
| where PreciseTimeStamp > _startTime and PreciseTimeStamp < _endTime
};
let actual = query("var1")
| union query("var2");
formatted (w/ your bug, on current version published to extension marketplace v1.0.40)
let query = (kustotable: string)
{
cluster(kustotable).database("DBName").TableName
| where PreciseTimeStamp > _startTime and PreciseTimeStamp < _endTime
};
let actual = query;("var1")
| union query,("var2");
Fix is deployed w/ v1.0.41
Name: [Kuskus] Kusto Language Server Id: rosshamish.kuskus-kusto-language-server Description: Language server for the Kusto query language Version: 1.0.41 Publisher: rosshamish VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=rosshamish.kuskus-kusto-language-server
Looks like it works! Thanks @rosshamish
Excellent
There is an issue with formatting aka prettifying the code
Code example
prettify changes the syntax to
Note the comma and semicolon after query - this should not be there.