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