Comment/Uncomment multiple lines

Copper Contributor

Hi all, 

Do you know a way to comment and uncomment multiple lines in the Logs Blade in Azure Sentinel ? I find it not convenient to type "//" every time.
Is there a way to create a custom shortcut for it ? 

Kind regards, 

Emmanuel NGUYEN

7 Replies

@emmanuelnguyen You made me chuckle a little bit. Personally, I think its much easier to type two slashes (//) than some of the other remarking operators for other query and scripting platforms. 

 

However, you can use something like AutoHotkey (https://www.autohotkey.com/) to develop your own keyboard shortcuts that and assign the KQL commenting operator to a custom keystroke combination.

 

I think its awesome that you're commenting, though. Commenting in the queries is a perfect example of a best practice for developing queries that can be shared and redistributed with colleagues and teammates, but also available to quickly comprehend at a later date.

@emmanuelnguyen There is currently no block comment in KQL.   The editor in Azure Sentinel has no macro or shortcut feature so you would need to enter the "//" for each line.  

 

Well, that is not entirely true.  There is a Command Palette that you can access by pressing F1 and there is a "Insert Line Comment" that is supposed to work by pressing Ctrl-K, Ctrl-C but it does not appear to work (at least not in my environment)

@Rod_Trent I agree with you, that two slashes "//" are a good and fast way to comment one line. But I think it's too bad that there aren't a way to comment a block/multiple lines with only one shortcut, rather than typing "//" at each line. 

What is weird is that in the command palette, as @Gary Bushey said, there is a command line for that "Toggle Block Comment" --> "Shift+Alt+A" but it's not working in my environment. And it seems that I'm not the only one. 

Thank you for the recommendation about AutoHotkey, although I'm not certain that it will allow me to do this precise operation.

Not sure if it is too late to reply to this thread but I came across this and did a bit of search.

Control+K+C works for me to comment multiple lines in Kusto

Control+K+U is for uncommenting lines. Tested and it worked for me without any problems.

 

Seems these are the shortcuts used in Visual Studio too.

 

Hope this helps someone.

@SaintOtis12 

 

"//" is easy for commenting a single line. I do lot of scripting in kusto so, I need sometimes to comment and uncomment multiple lines when i am testing my scripts. I find '//' can be a bit much when commenting or uncommenting 3 lines or more in a single instance.

Highlight the lines you wish to comment, then press CTRL and / and do the same to uncomment
CTRL and / worked very well. Thank you!