Skip to content

Add Select a Translation Unit command - #14688

Open
Sean McManus (sean-mcmanus) wants to merge 5 commits into
mainfrom
seanmcm/devbox2-wsl/agent10/select-translation-unit
Open

Add Select a Translation Unit command#14688
Sean McManus (sean-mcmanus) wants to merge 5 commits into
mainfrom
seanmcm/devbox2-wsl/agent10/select-translation-unit

Conversation

@sean-mcmanus

Copy link
Copy Markdown
Contributor

Summary

Adds a Select a Translation Unit command for choosing which source file provides IntelliSense context for the active file. The command displays matching translation-unit candidates in a quick pick and marks the current selection.

This PR was investigated and created by Copilot with GPT-5.6 Sol (in VS Code). Any message starting with ✨Copilot: was sent by Copilot.

Details

  • Registers the command palette action.
  • Requests candidate paths and the current selection from the language server.
  • Maps candidate paths into the active workspace and sends the selected path back.
  • Labels the current translation unit with a check icon and description.

Validation

  • Extension ESLint checks
  • TypeScript compilation

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

Adds a command for selecting the translation unit that supplies IntelliSense context.

Changes:

  • Registers and localizes the command palette action.
  • Adds language-server request and notification plumbing.
  • Displays candidates with workspace-relative paths and marks the current selection.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
Extension/src/LanguageServer/extension.ts Implements translation-unit selection and path mapping.
Extension/src/LanguageServer/client.ts Adds language-server protocol methods and types.
Extension/package.nls.json Adds the localized command title.
Extension/package.json Contributes and conditionally exposes the command.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sean-mcmanus
Sean McManus (sean-mcmanus) marked this pull request as ready for review August 31, 2026 11:16
@sean-mcmanus
Sean McManus (sean-mcmanus) requested a review from a team as a code owner August 31, 2026 11:16

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.

✨Copilot (agent22): Reviewed the TypeScript side at 65e388ec as a companion to the language-server change. Two [Minor] findings on the new command, both about parity with the existing onSwitchHeaderSource sibling. The getEditorPath extraction itself is a genuine improvement — replacing the old startsWith prefix test with a path.relative containment check fixes a real false match (/ws-other/x.cpp matched a /ws root), and picking the longest matching root is correct for nested workspace folders.

Comment thread Extension/src/LanguageServer/extension.ts Outdated
Comment thread Extension/src/LanguageServer/extension.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pull Request

Development

Successfully merging this pull request may close these issues.

2 participants