提交 c78b1d7c 编写于 作者: J Johannes Rieken

Notebook outline shows icons for markdown and code entries, #95234

上级 93cd65f1
......@@ -25,6 +25,7 @@ import { prepareQuery } from 'vs/base/common/fuzzyScorer';
import { SymbolKind } from 'vs/editor/common/modes';
import { fuzzyScore, createMatches } from 'vs/base/common/filters';
import { onUnexpectedError } from 'vs/base/common/errors';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
export class GotoSymbolQuickAccessProvider extends AbstractGotoSymbolQuickAccessProvider {
......@@ -133,7 +134,8 @@ export class GotoSymbolQuickAccessProvider extends AbstractGotoSymbolQuickAccess
kind: SymbolKind.File,
index: idx,
score: 0,
label: entry.label,
label: entry.icon ? `$(${entry.icon.id}) ${entry.label}` : entry.label,
ariaLabel: entry.detail ? `${entry.label}, ${entry.detail}` : entry.label,
detail: entry.detail,
description: entry.description,
};
......@@ -232,6 +234,7 @@ Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions).registe
//#region toc definition and logic
export interface ITableOfContentsEntry {
icon?: ThemeIcon;
label: string;
detail?: string;
description?: string;
......
......@@ -6,7 +6,7 @@
import { TableOfContentsProviderRegistry, ITableOfContentsProvider, ITableOfContentsEntry } from 'vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess';
import { NotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookEditor';
import { CellKind } from 'vs/workbench/contrib/notebook/common/notebookCommon';
import { Codicon } from 'vs/base/common/codicons';
TableOfContentsProviderRegistry.register(NotebookEditor.ID, new class implements ITableOfContentsProvider {
async provideTableOfContents(editor: NotebookEditor) {
......@@ -26,6 +26,7 @@ TableOfContentsProviderRegistry.register(NotebookEditor.ID, new class implements
if (matches && matches.length) {
for (let j = 0; j < matches.length; j++) {
result.push({
icon: cell.cellKind === CellKind.Markdown ? Codicon.markdown : Codicon.code,
label: matches[j].replace(/^[ \t]*(\#+)/, ''),
reveal: () => {
editorWidget.revealInCenterIfOutsideViewport(cell);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册