feat: Add copy path to Project and Environments#170
Conversation
There was a problem hiding this comment.
PR Overview
This pull request refactors several commands, replacing direct calls to "window.showErrorMessage" with a custom "showErrorMessage" utility, updates logic for obtaining the active text editor URI, and adds a new "copyPathToClipboard" function for copying project and environment paths.
- Replaces window.showErrorMessage with showErrorMessage in multiple commands
- Switches from window.activeTextEditor to an activeTextEditor() helper when retrieving a URI
- Implements new clipboardWriteText utility and a copyPathToClipboard command for project and environment paths
Changes
| File | Description |
|---|---|
| src/features/envCommands.ts | Replaces error message calls, updates active editor usage, and adds copyPathToClipboard |
| src/extension.ts | Registers new commands (“copyEnvPath” and “copyProjectPath”) that invoke copyPathToClipboard |
| src/common/env.apis.ts | Adds clipboardWriteText function used by copyPathToClipboard |
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/features/envCommands.ts:568
- Consider handling cases where 'item' is not a recognized type. Adding an else branch or an error condition clarifies how unrecognized inputs should be handled.
export async function copyPathToClipboard(item: unknown): Promise<void> {
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
There was a problem hiding this comment.
Copilot reviewed 4 out of 6 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- package.json: Language not supported
- package.nls.json: Language not supported
Comments suppressed due to low confidence (3)
src/features/envCommands.ts:575
- Joining the quoted arguments with a space may lead to ambiguous command strings if run.args contain spaces. Consider reviewing the quoting logic to handle edge cases more robustly.
const envPath = quoteArgs([run.executable, ...(run.args ?? [])]).join(' ');
src/extension.ts:182
- Both the 'python-envs.copyEnvPath' and 'python-envs.copyProjectPath' commands call the same copyPathToClipboard function. Confirm that this shared behavior is intended, or consider different implementations if the two commands should behave differently.
commands.registerCommand('python-envs.copyEnvPath', async (item) => {
src/extension.ts:185
- The 'python-envs.copyProjectPath' command uses the same function as 'python-envs.copyEnvPath', which may not distinguish between project and environment paths. Verify that this behavior matches the intended functionality for copying the different types of paths.
commands.registerCommand('python-envs.copyProjectPath', async (item) => {
Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more
|
If the changes appear safe, you can manually trigger the pipeline by commenting |
Closes #166