Question
Iryna Mykhailova · Dec 8, 2022

How to (un)comment multiple lines of code in Studio

A quick question. What's the shortcut to uncomment multiple lines of code in Studio? And what's the shortcut to comment out multiple lines of code in Studio?

Thanks in advance!

0
0 234
Discussion (10)4
Log in or sign up to continue

Does it work for you? I have 2022.2 and it doesn't work crying I press and nothing happens.

  • using InterSystems Studio Client  2022.2.0 Build 368  
  • the 2nd Menue shows to me 
    • <CTRL> + #  ,... for commenting
    • <CTRL>+ <SHIFT> + #
    • <CTRL> + <ALT> + #   ... for block commenting
    • <CTRL>+ <SHIFT> + <ALT> + #

Ive never tried the CTRL+ options before but teh CYRL+/ didnt work for me either.

Im not sure that keyboard shortcuts is what you are asking for though as /* comments out anything below it and */ terminates the commented lines i.e,

set A=1


/*

set A=2

set B=A

*/

write A // (which now equals 1)

write B // (which now causes an error)

quit

Sure, I know /* */ work.

But students use different IDEs so they get used to some behavior and adding multiline comments is apparently one of them. In my Studio it shows like this and the menu works but the shortcuts don't.

It seems there are different Studio versions around that cause confusion,

Could be a Keyboard dependency ? 
I use a German keyboard  where # is close / on a US keyboard,
might be * or ! on a French keyboard  (just guessing)

I don't really care what are the exact keystrokes, I just want them to work, and they don't  crying

Make sure that you select the whole lines, so that first character on each line is selected

Ok, I found it. It was Ctrl+/

But I have several / on my keyboard and only the one on the main keyboard (with letters) works.