Change:
This is an extension of It's caused by only checking lineNumber in: Steps to reproduce: the following text in your editor: from 2nd abc to last a find in selection, possibly by pressing <kbdAlt</kbd<kbdl</kbd:arrowleft:. Now the cursor is before 2nd a. 'Select all occurences of find match'. Notice that it selects 2nd to 5th abc, instead of 2nd to 4th: ! Does this issue occur when all extensions are disabled?: Yes VS Code version: Code 1.63.2 (, 2021-12-15T09:39:46.686Z) OS version: Linux x64 5.13.0-22-generic snap Restricted Mode: No <details<summarySystem Info</summary </details<details<summaryA/B Experiments</summary</details<!-- generated by issue reporter --
When you do . Now the cursor is before 2nd a. don't you lose the selection? Then what is the expected result of if there is no selection but the option is still selected?? I think it should really select all 5 occurrences of . And very oddly, when I do the command (via <kbdCtrl</kbd+<kbdShift</kbd+<kbdL</kbd) it is auto-enabling the and options become enabled. And then, since there is no selection, does select those last four occurrences of - as I think it should - the question is why doesn't it select the first . It is as if the setting is not respected when there is no selection but the option is enabled. [Of course, there really is a selection, but it is empty.]
From what I can tell, the feature (select all occurences of find match in search scope) only works when the find widget is made visible.
unfortunately the issue still persists even when find widget is visible. Find scope never respects selection column, only line. It seems like it was designed to be that way:

Discussion:
return new Selection(previousMatch.range.startLineNumber, previousMatch.range.startColumn, previousMatch.range.endLineNumber, previousMatch.range.endColumn); } <del> public selectAll(): FindMatch[] { </del> <ins> public selectAll(searchScope: Range[] | null): FindMatch[] { </ins> if (!this._editor.hasModel()) { return []; } this.findController.highlightFindOptions(); <del> return this._editor.getModel().findMatches(this.searchText, true, false, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER); </del> <ins> const editorModel = this._editor.getModel(); if (searchScope) { return editorModel.findMatches(this.searchText, searchScope, false, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER); } return editorModel.findMatches(this.searchText, true, false, this.matchCase, this.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER); </ins> } }

// - and the search string is non-empty // - and we're searching for a regex if (findState.isRevealed && findState.searchString.length > 0 && findState.isRegex) { <del> matches = this._editor.getModel().findMatches(findState.searchString, true, findState.isRegex, findState.matchCase, findState.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER); </del> <ins> const editorModel = this._editor.getModel(); if (findState.searchScope) { matches = editorModel.findMatches(findState.searchString, findState.searchScope, findState.isRegex, findState.matchCase, findState.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER); } else { matches = editorModel.findMatches(findState.searchString, true, findState.isRegex, findState.matchCase, findState.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false, Constants.MAX_SAFE_SMALL_INTEGER); } </ins> } else { this._beginSessionIfNeeded(findController);

return; } <del> matches = this._session.selectAll(); } if (findState.searchScope) { const states = findState.searchScope; let inSelection: FindMatch[] | null = []; matches.forEach((match) => { states.forEach((state) => { if (match.range.endLineNumber <= state.endLineNumber && match.range.startLineNumber >= state.startLineNumber) { inSelection!.push(match); } }); }); matches = inSelection; </del> <ins> matches = this._session.selectAll(findState.searchScope); </ins> } if (matches.length > 0) {