mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Searching within collapsed regions fails to scroll the match into view. Fixes #44330
This commit is contained in:
parent
d31961f900
commit
3293f204ce
|
@ -238,14 +238,18 @@ export class FoldingController implements IEditorContribution {
|
|||
this.getFoldingModel().then(foldingModel => { // null is returned if folding got disabled in the meantime
|
||||
if (foldingModel) {
|
||||
let selections = this.editor.getSelections();
|
||||
if (selections) {
|
||||
if (selections && selections.length > 0) {
|
||||
let toToggle = [];
|
||||
for (let selection of selections) {
|
||||
let lineNumber = selection.selectionStartLineNumber;
|
||||
if (this.hiddenRangeModel.isHidden(lineNumber)) {
|
||||
let toToggle = foldingModel.getAllRegionsAtLine(lineNumber, r => r.isCollapsed && lineNumber > r.startLineNumber);
|
||||
foldingModel.toggleCollapseState(toToggle);
|
||||
toToggle.push(...foldingModel.getAllRegionsAtLine(lineNumber, r => r.isCollapsed && lineNumber > r.startLineNumber));
|
||||
}
|
||||
}
|
||||
if (toToggle.length) {
|
||||
foldingModel.toggleCollapseState(toToggle);
|
||||
this.reveal(selections[0].getPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue