Written by

Associate professor at Igor Sikorsky Kyiv Polytechnic Institute
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!

Comments

Iryna Mykhailova  Dec 9, 2022 to Marcel den Ouden

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

0
Robert Cemper  Dec 9, 2022 to Iryna Mykhailova
  • 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> + #
0
Steve Riddle · Dec 9, 2022

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

0
Iryna Mykhailova  Dec 11, 2022 to Steve Riddle

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.

0
Robert Cemper  Dec 11, 2022 to Iryna Mykhailova

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)

0
Iryna Mykhailova  Dec 12, 2022 to Robert Cemper

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

0
Alexander Koblov  Dec 12, 2022 to Iryna Mykhailova

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

0
Iryna Mykhailova · Dec 13, 2022

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. 

0