提交 b93fa7bf 编写于 作者: M Matt Bierner

Use find for toc lookup

上级 01631fef
......@@ -56,13 +56,9 @@ export class TableOfContentsProvider {
}
public async lookup(fragment: string): Promise<TocEntry | undefined> {
const toc = await this.getToc();
const slug = Slug.fromHeading(fragment);
for (const entry of await this.getToc()) {
if (entry.slug.equals(slug)) {
return entry;
}
}
return undefined;
return toc.find(entry => entry.slug.equals(slug));
}
private async buildToc(document: vscode.TextDocument): Promise<TocEntry[]> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册