Skip to content

Disable Copy Breadcrumbs Path without symbols#318042

Merged
rzhao271 merged 2 commits into
microsoft:mainfrom
vivekjm:fix-breadcrumb-copy-path-availability
Jun 3, 2026
Merged

Disable Copy Breadcrumbs Path without symbols#318042
rzhao271 merged 2 commits into
microsoft:mainfrom
vivekjm:fix-breadcrumb-copy-path-availability

Conversation

@vivekjm

@vivekjm vivekjm commented May 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #286240

This updates the breadcrumbs context keys so Copy Breadcrumbs Path is only enabled when the current breadcrumbs include symbol items. The command already no-ops when there are no symbol breadcrumbs; this makes the menu and command availability match that behavior.

Testing:

  • npm ci --ignore-scripts
  • npm run compile-check-ts-native -- --pretty false
  • npx -y node@22.22.1 build/eslint.ts src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts
  • git diff --check

Note: the default npm run eslint -- src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts command failed under the machine's default Node v20.15.0 before linting because the repo currently expects Node 22. I reran the same lint entrypoint with Node 22.22.1.

Copilot AI review requested due to automatic review settings May 22, 2026 19:15

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 that tracks whether the current breadcrumbs contain symbol (outline) items, and uses it to conditionally enable/show the “Copy Breadcrumbs Path” action.

Changes:

  • Introduced breadcrumbsHasSymbols context key and wired it into lifecycle/reset/hide paths.
  • Set breadcrumbsHasSymbols based on the current breadcrumbs model elements.
  • Updated “Copy Breadcrumbs Path” command/menu conditions to require symbol breadcrumbs.

};
const items = model.getElements().map(element => element instanceof FileElement
const elements = model.getElements();
this._ckBreadcrumbsHasSymbols.set(elements.some(element => element instanceof OutlineElement2));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, good catch. I updated this in the latest push so breadcrumbsHasSymbols now uses the same classification as the rendering path: file breadcrumbs are FileElement, and everything else is treated as an outline/symbol breadcrumb.

title: localize2('cmd.copyPath', "Copy Breadcrumbs Path"),
category: Categories.View,
precondition: BreadcrumbsControl.CK_BreadcrumbsVisible,
precondition: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsVisible, BreadcrumbsControl.CK_BreadcrumbsHasSymbols),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The linked issue is specifically about this command being available when it cannot copy a symbol breadcrumb path, and the maintainer direction was to disable it when there is no symbol selection. File/folder path copying is already covered by the neighboring Copy Path and Copy Relative Path actions, so this keeps the command scoped to its current symbol-breadcrumb behavior.

group: '1_cutcopypaste',
order: 100,
when: BreadcrumbsControl.CK_BreadcrumbsPossible
when: ContextKeyExpr.and(BreadcrumbsControl.CK_BreadcrumbsPossible, BreadcrumbsControl.CK_BreadcrumbsHasSymbols)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same rationale as above: this PR intentionally keeps Copy Breadcrumbs Path scoped to symbol breadcrumbs per #286240 and the maintainer comment there. File-only breadcrumbs should continue to use the existing Copy Path / Copy Relative Path actions instead of making this command silently no-op.

@vivekjm vivekjm force-pushed the fix-breadcrumb-copy-path-availability branch from e4f966e to 9d350e6 Compare May 23, 2026 17:50
@rzhao271 rzhao271 merged commit a8673ca into microsoft:main Jun 3, 2026
25 checks passed
@rzhao271 rzhao271 added this to the 1.124.0 milestone 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