mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
use a parent pointer instead of 2d array, #67872
This commit is contained in:
@@ -944,14 +944,19 @@ class SelectionRangeAdapter {
|
||||
const oneResult: modes.SelectionRange[] = [];
|
||||
allResults.push(oneResult);
|
||||
|
||||
const oneProviderRanges = allProviderRanges[i];
|
||||
let last: vscode.Position | vscode.Range = positions[i];
|
||||
for (const selectionRange of oneProviderRanges) {
|
||||
let selectionRange = allProviderRanges[i];
|
||||
|
||||
while (true) {
|
||||
if (!selectionRange.range.contains(last)) {
|
||||
throw new Error('INVALID selection range, must contain the previous range');
|
||||
}
|
||||
oneResult.push(typeConvert.SelectionRange.from(selectionRange));
|
||||
if (!selectionRange.parent) {
|
||||
break;
|
||||
}
|
||||
last = selectionRange.range;
|
||||
selectionRange = selectionRange.parent;
|
||||
}
|
||||
}
|
||||
return allResults;
|
||||
|
||||
@@ -1098,9 +1098,11 @@ CodeActionKind.SourceFixAll = CodeActionKind.Source.append('fixAll');
|
||||
export class SelectionRange {
|
||||
|
||||
range: Range;
|
||||
parent?: SelectionRange;
|
||||
|
||||
constructor(range: Range) {
|
||||
constructor(range: Range, parent?: SelectionRange) {
|
||||
this.range = range;
|
||||
this.parent = parent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user