Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: disable breadcrumb path copy without symbols#318292

Closed
SpencerJung wants to merge 1 commit into
microsoft:mainfrom
SpencerJung:fix/286240-disable-empty-breadcrumb-copy
Closed

fix: disable breadcrumb path copy without symbols#318292
SpencerJung wants to merge 1 commit into
microsoft:mainfrom
SpencerJung:fix/286240-disable-empty-breadcrumb-copy

Conversation

@SpencerJung

Copy link
Copy Markdown

Related Issue

Closes #286240

Summary

Disable the Copy Breadcrumbs Path command unless the active breadcrumbs contain an actual symbol path.

The command previously stayed enabled for file-only breadcrumbs or placeholder symbol breadcrumbs and then silently returned without copying anything. This adds a breadcrumbs context key that is true only when at least one real outline breadcrumb is present, so the command/menu item is unavailable when it would be a no-op.

How to Test

  1. Open a file that has no symbol breadcrumb selection.
  2. Right-click the editor tab.
  3. Verify Copy Breadcrumbs Path is disabled/hidden while Copy Path and Copy Relative Path remain available.
  4. Open a file with symbol breadcrumbs and place the cursor inside a symbol.
  5. Verify Copy Breadcrumbs Path is available and still copies the symbol breadcrumb path.

Community Rules Review

  • CONTRIBUTING.md reviewed; it points code contributors to the VS Code wiki.
  • .github/pull_request_template.md reviewed and included above.
  • VS Code wiki reviewed: CLA required, one PR per issue, linked issue, small changes, coding guidelines, and tests whenever possible.
  • CI reviewed: .github/workflows/pr.yml targets main and runs Compile & Hygiene plus Linux/macOS/Windows test workflows.
  • Base branch: main, confirmed via gh repo view microsoft/vscode --json defaultBranchRef.

Verification Evidence

Dependency Setup

  • bun install: attempted; failed building @vscode/sqlite3 because local Windows environment lacks Visual Studio C++ Build Tools.
  • Fallback: npm install --ignore-scripts succeeded for static tooling; generated package-lock.json diff was restored before code changes.
  • Environment note: repository .nvmrc expects Node 22.22.1; local Node is 24.14.0.

Tests

  • node test/unit/browser/index.js --grep "Breadcrumb": runner completed with exit code 0 after installing Playwright browsers, but reported 0 passing, so no matching automated test executed.
  • bun test --bail: unavailable for this repo setup; Bun starts test/monaco/monaco.test.ts and fails resolving chai before reaching this change.

Type Check

  • npm run compile-check-ts-native: passed.
  • LSP diagnostics for src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts: no diagnostics.
  • bun run typecheck: unavailable because VS Code root package.json has no typecheck script.

Build

  • bun run build: unavailable because VS Code root package.json has no build script.
  • Official VS Code build/CI equivalent is Compile & Hygiene in .github/workflows/pr.yml; local full build was not run because native dependency installation failed without Visual Studio C++ Build Tools.

Diff Summary

src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

Checklist

  • Base branch is main
  • Associated issue is linked
  • No unauthorized version bump
  • All feasible verification checks attempted; unavailable checks documented with reason
  • Commits split if >=3 files changed (single-file change)
  • No unintended schema or lockfile regeneration

Copilot AI review requested due to automatic review settings May 26, 2026 06:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new context key to indicate when breadcrumbs include a symbol path, and uses it to gate the “Copy Breadcrumbs Path” action so it’s only available when symbols are present.

Changes:

  • Introduces breadcrumbsSymbolPath context key and wires it into BreadcrumbsControl lifecycle.
  • Computes whether the current breadcrumbs include a symbol segment (outline element) and updates the context key.
  • Updates command/menu when/precondition expressions for breadcrumbs.copyPath to require breadcrumbsSymbolPath.

title: localize2('cmd.copyPath', "Copy Breadcrumbs Path"),
category: Categories.View,
precondition: BreadcrumbsControl.CK_BreadcrumbsVisible,
precondition: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsSymbolPath),
group: '1_cutcopypaste',
order: 100,
when: BreadcrumbsControl.CK_BreadcrumbsPossible
when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsPossible, BreadcrumbsControl.CK_BreadcrumbsSymbolPath)
};
const items = model.getElements().map(element => element instanceof FileElement
const elements = model.getElements();
this._ckBreadcrumbsSymbolPath.set(elements.some(element => element instanceof OutlineElement2 && element.element !== element.outline));
Comment on lines +418 to 422
this._ckBreadcrumbsSymbolPath.set(elements.some(element => element instanceof OutlineElement2 && element.element !== element.outline));

const items = elements.map(element => element instanceof FileElement
? this._instantiationService.createInstance(FileItem, model, element, options, this._labels, this._hoverDelegate)
: this._instantiationService.createInstance(OutlineItem, model, element, options));
@dmitrivMS

Copy link
Copy Markdown
Contributor

This has been done by #318042

@dmitrivMS dmitrivMS closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copy Breadcrumb Path doesn't do anything when you're not focused on a symbol

5 participants