提交 4afc1ee4 编写于 作者: J Johannes Rieken

retore awol feature and fix tests with that

上级 6fa83ab2
......@@ -443,7 +443,7 @@ export class OutlineModel extends TreeElement {
}
}
asListOfDocumentSymbols(): DocumentSymbol[] {
getTopLevelSymbols(): DocumentSymbol[] {
const roots: DocumentSymbol[] = [];
for (const child of this.children.values()) {
if (child instanceof OutlineElement) {
......@@ -452,9 +452,14 @@ export class OutlineModel extends TreeElement {
roots.push(...Iterable.map(child.children.values(), child => child.symbol));
}
}
return roots.sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
}
asListOfDocumentSymbols(): DocumentSymbol[] {
const roots = this.getTopLevelSymbols();
const bucket: DocumentSymbol[] = [];
OutlineModel._flattenDocumentSymbols(bucket, roots, '');
return bucket;
return bucket.sort((a, b) => Range.compareRangesUsingStarts(a.range, b.range));
}
private static _flattenDocumentSymbols(bucket: DocumentSymbol[], entries: DocumentSymbol[], overrideContainerLabel: string): void {
......
......@@ -15,7 +15,9 @@ import { assertType } from 'vs/base/common/types';
export async function getDocumentSymbols(document: ITextModel, flat: boolean, token: CancellationToken): Promise<DocumentSymbol[]> {
const model = await OutlineModel.create(document, token);
return model.asListOfDocumentSymbols();
return flat
? model.asListOfDocumentSymbols()
: model.getTopLevelSymbols();
}
CommandsRegistry.registerCommand('_executeDocumentSymbolProvider', async function (accessor, ...args) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册