Does anyone know how to turn an vscode editor selection range into a multi cursor selection?
for instance on this line:
"out of this line I'd like to select this|"

- run the key bind selection would turn into multi cursor like so "out of this line I'd like to | select this |"
CodePudding user response:
Here is the entire code of the extension:
const vscode = require('vscode');
/**
* @param {vscode.ExtensionContext} context
*/
function activate(context) {
let disposable = vscode.commands.registerCommand('convert-selection.surround', function () {
const editor = vscode.window.activeTextEditor;
const selections = editor.selections;
const newSelections = [];
for (const selection of selections) {
const newSelection1 = new vscode.Selection(selection.start, selection.start);
const newSelection2 = new vscode.Selection(selection.end, selection.end);
newSelections.push(newSelection1, newSelection2);
}
editor.selections = newSelections;
});
context.subscriptions.push(disposable);
}
exports.activate = activate;


