Skip to content

Show breadcrumbs for untitled Markdown once outline exists#315386

Draft
Copilot wants to merge 7 commits into
mainfrom
copilot/enable-breadcrumbs-for-unsaved-files
Draft

Show breadcrumbs for untitled Markdown once outline exists#315386
Copilot wants to merge 7 commits into
mainfrom
copilot/enable-breadcrumbs-for-unsaved-files

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Untitled Markdown editors could show a populated Outline while breadcrumbs stayed hidden. The visibility logic treated all empty untitled breadcrumb states as “not displayable,” including the state after outline creation.

  • Behavioral change

    • Breadcrumbs are now hidden for untitled editors only while no outline instance exists.
    • Once outline infrastructure is available, breadcrumbs render the normal empty-state item instead of remaining hidden indefinitely.
  • Implementation

    • Added hasOutline() to BreadcrumbsModel as an explicit signal for outline availability.
    • Updated BreadcrumbsControl empty-items branch to gate untitled hiding on !model.hasOutline().
  • Model coverage

    • Extended breadcrumb model unit coverage to assert the untitled/no-outline state contract.
if (items.length === 0) {
	if (model.resource.scheme === Schemas.untitled && !model.hasOutline()) {
		this._setVisibility(false);
	} else {
		this._setVisibility(true);
		// render empty-state breadcrumb item
	}
}

Copilot AI requested review from Copilot and removed request for Copilot May 8, 2026 22:20
Copilot AI linked an issue May 8, 2026 that may be closed by this pull request
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 8, 2026 22:26
Copilot AI changed the title [WIP] Add support for breadcrumbs in unsaved files Enable breadcrumbs for unsaved (untitled) files May 8, 2026
Copilot AI requested a review from dmitrivMS May 8, 2026 22:27
@dmitrivMS
Copy link
Copy Markdown
Contributor

@copilot This change will show empty line for files without symbols (see issues linked in the issue we are fixing). Can we avoid that (by checking for symbols?)?

Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 12, 2026 21:41
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot This change will show empty line for files without symbols (see issues linked in the issue we are fixing). Can we avoid that (by checking for symbols?)?

Fixed in the latest commit. In updateBreadcrumbs, when the resource is untitled:// and there are no items, hide() is called instead of showing the empty "no elements" bar. The show() in the else branch handles the async case: when the outline loads later and symbols become available, the breadcrumbs reappear with just the symbol crumbs.

@dmitrivMS
Copy link
Copy Markdown
Contributor

@copilot will this make breadcrumb flash on an empty file?

Copilot AI review requested due to automatic review settings May 12, 2026 22:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables breadcrumbs to work for unsaved untitled:// editors by allowing them through the IFileService.hasProvider(uri) guard so they can still participate in the breadcrumbs pipeline (primarily via outline/symbol breadcrumbs, since untitled resources have no file path crumbs).

Changes:

  • Allow untitled:// URIs in BreadcrumbsControl.update() even when no file provider exists.
  • Adjust empty-breadcrumb behavior for untitled resources to hide the control until symbols are available.
  • Add a unit test asserting untitled URIs produce no file-path breadcrumb elements in BreadcrumbsModel.
Show a summary per file
File Description
src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts Allows breadcrumbs for untitled:// resources and tweaks empty-state behavior.
src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts Adds coverage for untitled URIs producing no file path crumbs.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts Outdated
Comment thread src/vs/workbench/test/browser/parts/editor/breadcrumbModel.test.ts Outdated
Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot will this make breadcrumb flash on an empty file?

No flash. The previous code already avoided it — both show() and the immediate hide() ran in the same synchronous call before any browser paint. But I've gone further and removed the unconditional show() from the top of update() entirely; show() is now only called inside updateBreadcrumbs() when there are actually items to display, so for untitled files with no symbols the show→hide cycle is gone completely.

@dmitrivMS
Copy link
Copy Markdown
Contributor

@copilot seems like there are some comments on the PR

…sposables; fix test URI path

Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 12, 2026

@copilot seems like there are some comments on the PR

Both review comments addressed in the latest commit:

  1. Disposables bug — replaced the hide()/show() calls inside updateBreadcrumbs with a new private _setVisibility(visible) that only toggles the DOM class and context key (no _breadcrumbsDisposables.clear()). The model.onDidUpdate listener is now preserved, so symbols appearing asynchronously will correctly re-show the breadcrumbs. The public hide() method (which does clear disposables) is still used only at the top of update() for the "no provider" early-return path.

  2. Test URI form — updated to path: 'Untitled-1' (no leading slash), matching the canonical untitled URI shape.

@dmitrivMS
Copy link
Copy Markdown
Contributor

@copilot if I create untitled file, paste some markdown, switch language mode to Markdown -> I don't see a breadcrumb, but I see Outline populated

Co-authored-by: dmitrivMS <9581278+dmitrivMS@users.noreply.github.com>
Copilot AI changed the title Enable breadcrumbs for unsaved (untitled) files Show breadcrumbs for untitled Markdown once outline exists May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable breadcrumbs for unsaved files

3 participants