5

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

omid
  • 702
  • 1
  • 11
  • 21

2 Answers2

4

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.

Jill Cheng
  • 9,179
  • 1
  • 20
  • 25
0

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 1
    let me explain, the exact behavior I want is: cursor is on the definition line of a function or any line inside the function's block, then I can use a command to select current line and then all lines of the function. – omid Jul 21 '20 at 08:12