fix: disable breadcrumb path copy without symbols#318292
Closed
SpencerJung wants to merge 1 commit into
Closed
Conversation
Closes microsoft#286240 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
Contributor
There was a problem hiding this comment.
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
breadcrumbsSymbolPathcontext key and wires it intoBreadcrumbsControllifecycle. - Computes whether the current breadcrumbs include a symbol segment (outline element) and updates the context key.
- Updates command/menu
when/preconditionexpressions forbreadcrumbs.copyPathto requirebreadcrumbsSymbolPath.
| 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)); |
4 tasks
Contributor
|
This has been done by #318042 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Closes #286240
Summary
Disable the
Copy Breadcrumbs Pathcommand 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
Copy Breadcrumbs Pathis disabled/hidden whileCopy PathandCopy Relative Pathremain available.Copy Breadcrumbs Pathis available and still copies the symbol breadcrumb path.Community Rules Review
CONTRIBUTING.mdreviewed; it points code contributors to the VS Code wiki..github/pull_request_template.mdreviewed and included above..github/workflows/pr.ymltargetsmainand runs Compile & Hygiene plus Linux/macOS/Windows test workflows.main, confirmed viagh repo view microsoft/vscode --json defaultBranchRef.Verification Evidence
Dependency Setup
bun install: attempted; failed building@vscode/sqlite3because local Windows environment lacks Visual Studio C++ Build Tools.npm install --ignore-scriptssucceeded for static tooling; generatedpackage-lock.jsondiff was restored before code changes..nvmrcexpects Node22.22.1; local Node is24.14.0.Tests
node test/unit/browser/index.js --grep "Breadcrumb": runner completed with exit code 0 after installing Playwright browsers, but reported0 passing, so no matching automated test executed.bun test --bail: unavailable for this repo setup; Bun startstest/monaco/monaco.test.tsand fails resolvingchaibefore reaching this change.Type Check
npm run compile-check-ts-native: passed.src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts: no diagnostics.bun run typecheck: unavailable because VS Code rootpackage.jsonhas notypecheckscript.Build
bun run build: unavailable because VS Code rootpackage.jsonhas nobuildscript..github/workflows/pr.yml; local full build was not run because native dependency installation failed without Visual Studio C++ Build Tools.Diff Summary
Checklist
main