Change:
Issue Type: <bBug</bmultiple brackets "" Expected: All cursors at brackets become selections starting where the original cursor was and and ending at its matching bracket. Actual: Only the first cursor becomes a selection, the rest dissapear. VS Code version: Code 1.21.0 (, 2018-03-07T10:54:22.798Z) OS version: Darwin x64 17.3.0 </detailsReproduces without extensions <!-- generated by issue reporter --
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like: <!-- score: 0.531 --- <!-- score: 0.527 --- <!-- score: 0.498 --- <!-- score: 0.498 --<!-- potentialduplicatescomment --

Discussion:
if (!model) { return; } <del> const selection = this._editor.getSelection(); if (!selection.isEmpty()) { return; } const position = selection.getStartPosition(); </del> <ins> let newSelections: Selection[] = []; this._editor.getSelections().forEach(selection => { const position = selection.getStartPosition(); </ins> <del> let brackets = model.matchBracket(position); </del> <ins> let brackets = model.matchBracket(position); </ins> <del> let openBracket: Position = null; let closeBracket: Position = null; </del> <ins> let openBracket: Position = null; let closeBracket: Position = null; </ins> <del> if (!brackets) { const nextBracket = model.findNextBracket(position); if (nextBracket && nextBracket.range) { brackets = model.matchBracket(nextBracket.range.getStartPosition()); </del> <ins> if (!brackets) { const nextBracket = model.findNextBracket(position); if (nextBracket && nextBracket.range) { brackets = model.matchBracket(nextBracket.range.getStartPosition()); } </ins> } <del> } if (brackets) { if (brackets[0].startLineNumber === brackets[1].startLineNumber) { openBracket = brackets[1].startColumn < brackets[0].startColumn ? brackets[1].getStartPosition() : brackets[0].getStartPosition(); closeBracket = brackets[1].startColumn < brackets[0].startColumn ? brackets[0].getEndPosition() : brackets[1].getEndPosition(); } else { openBracket = brackets[1].startLineNumber < brackets[0].startLineNumber ? brackets[1].getStartPosition() : brackets[0].getStartPosition(); closeBracket = brackets[1].startLineNumber < brackets[0].startLineNumber ? brackets[0].getEndPosition() : brackets[1].getEndPosition(); </del> <ins> if (brackets) { if (brackets[0].startLineNumber === brackets[1].startLineNumber) { openBracket = brackets[1].startColumn < brackets[0].startColumn ? brackets[1].getStartPosition() : brackets[0].getStartPosition(); closeBracket = brackets[1].startColumn < brackets[0].startColumn ? brackets[0].getEndPosition() : brackets[1].getEndPosition(); } else { openBracket = brackets[1].startLineNumber < brackets[0].startLineNumber ? brackets[1].getStartPosition() : brackets[0].getStartPosition(); closeBracket = brackets[1].startLineNumber < brackets[0].startLineNumber ? brackets[0].getEndPosition() : brackets[1].getEndPosition(); } </ins> } <del> } if (openBracket && closeBracket) { this._editor.setSelection(new Range(openBracket.lineNumber, openBracket.column, closeBracket.lineNumber, closeBracket.column)); </del> <ins> if (openBracket && closeBracket) { newSelections.push(new Selection(openBracket.lineNumber, openBracket.column, closeBracket.lineNumber, closeBracket.column)); } }); if (newSelections.length > 0) { this._editor.setSelections(newSelections); this._editor.revealRange(newSelections[0]); </ins> } }

model.dispose(); mode.dispose(); }); <ins> test('issue #45369: Select to Bracket with multicursor', () => { let mode = new BracketMode(); let model = TextModel.createFromString('{  }   {   }   { }', undefined, mode.getLanguageIdentifier()); withTestCodeEditor(null, { model: model }, (editor, cursor) => { let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController); // cursors inside brackets become selections of the entire bracket contents editor.setSelections([ new Selection(1, 3, 1, 3), new Selection(1, 10, 1, 10), new Selection(1, 17, 1, 17) ]); bracketMatchingController.selectToBracket(); assert.deepEqual(editor.getSelections(), [ new Selection(1, 1, 1, 5), new Selection(1, 8, 1, 13), new Selection(1, 16, 1, 19) ]); // cursors to the left of bracket pairs become selections of the entire pair editor.setSelections([ new Selection(1, 1, 1, 1), new Selection(1, 6, 1, 6), new Selection(1, 14, 1, 14) ]); bracketMatchingController.selectToBracket(); assert.deepEqual(editor.getSelections(), [ new Selection(1, 1, 1, 5), new Selection(1, 8, 1, 13), new Selection(1, 16, 1, 19) ]); // cursors just right of a bracket pair become selections of the entire pair editor.setSelections([ new Selection(1, 5, 1, 5), new Selection(1, 13, 1, 13), new Selection(1, 19, 1, 19) ]); bracketMatchingController.selectToBracket(); assert.deepEqual(editor.getSelections(), [ new Selection(1, 1, 1, 5), new Selection(1, 8, 1, 13), new Selection(1, 16, 1, 19) ]); bracketMatchingController.dispose(); }); model.dispose(); mode.dispose(); }); </ins> });