Change:
await assertRanges(new BracketSelectionRangeProvider(), '|[[[]()]]'); // edge <del> await assertRanges(new BracketSelectionRangeProvider(), '[|[[]()]]', new Range(1, 2, 1, 9), new Range(1, 1, 1, 10)); await assertRanges(new BracketSelectionRangeProvider(), '[[[]()]|]', new Range(1, 2, 1, 9), new Range(1, 1, 1, 10)); </del> <ins> await assertRanges(new BracketSelectionRangeProvider(), '[|[[]()]]', new Range(1, 2, 1, 8), new Range(1, 1, 1, 9)); await assertRanges(new BracketSelectionRangeProvider(), '[[[]()]|]', new Range(1, 2, 1, 8), new Range(1, 1, 1, 9)); </ins> <del> await assertRanges(new BracketSelectionRangeProvider(), 'aaa(aaa)bbb(b|b)ccc(ccc)', new Range(1, 13, 1, 16), new Range(1, 12, 1, 17)); await assertRanges(new BracketSelectionRangeProvider(), '(aaa(aaa)bbb(b|b)ccc(ccc))', new Range(1, 14, 1, 17), new Range(1, 13, 1, 18), new Range(1, 2, 1, 26), new Range(1, 1, 1, 27)); </del> <ins> await assertRanges(new BracketSelectionRangeProvider(), 'aaa(aaa)bbb(b|b)ccc(ccc)', new Range(1, 13, 1, 15), new Range(1, 12, 1, 16)); await assertRanges(new BracketSelectionRangeProvider(), '(aaa(aaa)bbb(b|b)ccc(ccc))', new Range(1, 14, 1, 16), new Range(1, 13, 1, 17), new Range(1, 2, 1, 25), new Range(1, 1, 1, 26)); </ins> }); test('bracket with leading/trailing', async () => { await assertRanges(new BracketSelectionRangeProvider(), 'for(a of b){n  foo(|);n}', <del> new Range(2, 7, 2, 8), new Range(2, 6, 2, 9), </del> <ins> new Range(2, 7, 2, 7), new Range(2, 6, 2, 8), </ins> new Range(1, 13, 3, 1), new Range(1, 12, 3, 2), new Range(1, 1, 3, 2), new Range(1, 1, 3, 2), ); await assertRanges(new BracketSelectionRangeProvider(), 'for(a of b)n{n  foo(|);n}', <del> new Range(3, 7, 3, 8), new Range(3, 6, 3, 9), </del> <ins> new Range(3, 7, 3, 7), new Range(3, 6, 3, 8), </ins> new Range(2, 2, 4, 1), new Range(2, 1, 4, 2), new Range(1, 1, 4, 2), new Range(1, 1, 4, 2), );

Discussion:
Issue Type: <bBug</bany file which contains word consisting of letters with underscores (f.e. helloworld). For simplicity let's assume only one underscore is present. cursor in various places of this word and activate expand selection command (either via keyboard shortcut or keybinding) : 3a. cursor is not near underscore (underscore is not immediately to the left or right of cursor) - part of the word selected, bounded by word beginning/end and underscore - OK 3b. underscore is immediately left to the cursor - part of word to the right of cursor is selected - OK 3c. underscore is immediately right to the cursor - the whole word is selected - UNEXPECTED. For 3c I expected only part of the word selected as well, not the whole word. VS Code version: Code 1.42.0 (, 2020-02-06T10:51:34.058Z) OS version: WindowsNT x64 10.0. <details<summarySystem Info</summary </details<details<summaryExtensions (10)</summaryExtensionVersion ------ quick-open-prefill-selection0.0.1 vscode-eslint2.0.15 gitlens10.2.1 EditorConfig0.14.4 vscode-great-icons2.1.47 intellij-idea-keybindings0.2.37 camelcasenavigation1.1.1 material-icon-theme3.9.3 partial-diff1.4.1 terminal-tabs0.2.0 (5 theme extensions excluded) </details<!-- generated by issue reporter --
Tried to fix this in the PR PS - this is my first PR for a OSS, ever... please forgive me for any mistake or misconduct.