vscode select code block doesn't work for python methods

Viewed 1368

I'm trying to use default vscode block selection (alt + shift + ) but it doesn't work for python methods(it selects the whole first line and then go crazy and select whole file). I couldn't find any useful extension. do you have any suggestion?

Update:

as @jill-cheng said currently the best approach is to fold the block using Ctrl + Shift + [ and select the whole line using Ctrl + l

for folding shortcuts refer to https://stackoverflow.com/a/30077543/13877794

2 Answers

At present, vscode does not support automatic recognition and quick selection of Python function blocks.

Usually, this function is identified by the '{ }' of the function.

You could use the shortcut key 'Ctrl + L' to select a single line of code. As for selecting the python function block, you can try to collapse it and select it.(Select until the cursor is on the next line.)

For more information:Key Bindings.

May I know what exactly you mean by block selection? And also the alt + shift + works the same way for other files as well, not only for python. If you meant to say select multiple lines, try shift + . It selects one line at a time.

Related