admin管理员组

文章数量:1310099

How can I configure Visual Studio Code to enable column selection (multi-line selection) like this:

  • Drag a line with Alt+Mouse 1
  • When crossing a line with lower indentation level, create indentation implicitly to match the indentation level indicated by the drawn line

On the left-hand side you can see the desired behaviour (in TextMate), on the right-hand side my current attempt in VS Code:

How can I configure Visual Studio Code to enable column selection (multi-line selection) like this:

  • Drag a line with Alt+Mouse 1
  • When crossing a line with lower indentation level, create indentation implicitly to match the indentation level indicated by the drawn line

On the left-hand side you can see the desired behaviour (in TextMate), on the right-hand side my current attempt in VS Code:

Share Improve this question edited Feb 2 at 16:39 marc_s 755k184 gold badges1.4k silver badges1.5k bronze badges asked Feb 2 at 11:06 fiedlfiedl 6,1477 gold badges47 silver badges60 bronze badges 1
  • 1 No built-in way to do that. Search for "virtual space" here on SO for other questions about this. – Mark Commented Feb 2 at 18:06
Add a comment  | 

1 Answer 1

Reset to default 2

Virtual-Space Pull Request

Apparently, an underlying feature, which is called virtual space, has been requested in 2016. A pull request from September 2024 is yet to be merged. The scope of the pull request is wider than the column-selection feature, but does include it.

Demo

I've just tried out the pull request and it resolves the issue.

How to Install the Pull-Request Version

[2025-02-03 12:59:05] fiedl@fiedl-mbp ~/code
▶ git clone [email protected]:microsoft/vscode.git

[2025-02-03 12:59:05] fiedl@fiedl-mbp ~/code/vscode
▶ git remote add x17jiri [email protected]:x17jiri/vscode.git
▶ git checkout x17jiri/virtual-space-4
▶ brew install node@20
▶ npm install
▶ npm run watch
▶ ./scripts/code.sh

本文标签: textselectionConfigure straightcolumn selection with mouse in VS CodeStack Overflow