Skip to content

Conversation

@karthiknadig
Copy link
Member

@karthiknadig karthiknadig commented Feb 7, 2025

Closes #166

@karthiknadig karthiknadig added the feature-request Request for new features or functionality label Feb 7, 2025
@karthiknadig karthiknadig self-assigned this Feb 7, 2025
@karthiknadig karthiknadig requested a review from Copilot February 7, 2025 19:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@karthiknadig karthiknadig requested a review from Copilot February 7, 2025 21:42
@karthiknadig karthiknadig added this to the February 2025 milestone Feb 7, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@karthiknadig karthiknadig marked this pull request as ready for review February 7, 2025 21:46
@karthiknadig karthiknadig enabled auto-merge (squash) February 7, 2025 21:47
@vs-code-engineering
Copy link

⚠️ This PR originates from a fork. Due to security restrictions, pipelines from forks are no longer triggered automatically. Learn more.

If the changes appear safe, you can manually trigger the pipeline by commenting /AzurePipelines run.

@karthiknadig karthiknadig merged commit a8f6dd5 into microsoft:main Feb 7, 2025
6 checks passed
@karthiknadig karthiknadig deleted the copy-path branch February 7, 2025 23:05
NguyenCuong1989 referenced this pull request in NguyenCuong1989/vscode-python-environments Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature-request Request for new features or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Copy Path to context menu

2 participants