Select Entire Function + Comment Out + Un Comment

Hey Anvil Team, hope you all are having a great Friday!

I was thinking this would be a slick quality of life feature.

Currently when a user left clicks a line, the IDE selects the entire line as shown:
lol

Which is great.

What I’m proposing is that on the first click, the functionality stays the same, but on the second click, if the first line is the function signature, the entire function gets selected.

Furthermore, if you right click on the line number while the entire function is selected, there’s a drop down selection to comment out / un comment depending on the state of the currently selected text.

The comment out + un comment feature could also be done with keyboard shortcuts.

Cheers :slight_smile:

2 Likes

I agree with the FR about the second click selecting the whole function, but I would like to add a couple of cents.

The first thing is that if you first fold the function, then select the line, you are actually selecting the whole function. If you then press Ctrl+/, you will comment the whole function. Unfortunately multi-line comments are not foldable, so this will not help to uncomment it.

The second thing is that I don’t like to use the mouse, I like to use keyboard shortcuts, so I would like to have the same feature accessible via a shortcut.

Even better, I would like to have two shortcuts that I use and abuse in PyCharm: Ctrl+W and Alt+J.

Pressing Ctrl+W twice when the cursor is on the function name, selects the whole function. If the cursor is somewhere inside the function, each keypress will expand the selection to include the next larger meaningful chunk of code, after a few presses the whole function will be selected. Pressing Shift+Ctrl+W will shrink the selection to the previous chunk. This shortcut considers multi-line comments as one meaningful chunk of code.

1 Like