Skip to content
This repository was archived by the owner on Oct 23, 2025. It is now read-only.

Conversation

@NguyenCuong1989
Copy link
Owner

Không được tạo kho mã nữa

karthiknadig and others added 30 commits February 7, 2025 14:23
fixes microsoft/vscode-python-environments#159

We need to wrap the API in a try-catch block to handle any potential
errors that might occur as it is currently being worked on.
Adding isTrusted field as part of shell env api, meaning the shape would
change a bit.
Accessing shell env would be `.env.value` instead of `.env`.

Trying to prevent breaking where this api is already being used, so that
I can safely merge: microsoft/vscode#240971
* ensure skip install is only shown when relevant 
* ensure delete env message is modal

fixes microsoft/vscode-python-environments#220
Bumps [tar-fs](https://github.com/mafintosh/tar-fs) from 2.1.1 to 2.1.2.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/mafintosh/tar-fs/commit/d97731b0e1b8a244ab859784b514cfcf5585ad3d"><code>d97731b</code></a>
2.1.2</li>
<li><a
href="https://github.com/mafintosh/tar-fs/commit/fd1634e869e7c5f85948e95eabdaa8451a085de5"><code>fd1634e</code></a>
symlink tweak from main</li>
<li>See full diff in <a
href="https://github.com/mafintosh/tar-fs/compare/v2.1.1...v2.1.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tar-fs&package-manager=npm_and_yarn&previous-version=2.1.1&new-version=2.1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/microsoft/vscode-python-environments/network/alerts).

</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
⚠️ BREAKING CHANGE: This PR has an API change that replaces `install`
and `uninstall` methods on package manager with `manage`.

Reasoning: Both the install and uninstall flows did very similar things.
In all the implementations this was duplicating the steps. The idea here
is to make it easier from the flow perspective.


![image](https://github.com/user-attachments/assets/53087fca-ddc9-44f4-bcb9-9b005264db56)
…288)

The description seems to be a leftover from #279.
eleanorjboyd and others added 27 commits October 2, 2025 15:05
Reverts microsoft/vscode-python-environments#891

the tests weren't passing and I didn't realize it would merge it in
without that criteria met
Fixes microsoft/vscode-python-environments#506

Added an explicit glob pattern `*requirements*.txt` to ensure
requirements files at the workspace root are reliably found. The fix
includes:

1. **Additional search pattern**: Added
`findFiles('*requirements*.txt')` to explicitly search the workspace
root
2. **Deduplication logic**: Implemented deduplication using a Map keyed
by file system path to handle overlapping patterns
3. **Comprehensive tests**: Created 5 new unit tests to validate the fix

Now both patterns work together:
- `**/*requirements*.txt` - finds requirements files in subdirectories
- `*requirements*.txt` - finds requirements files at workspace root

## Requirements Files Now Discovered

This fix ensures all common requirements file naming patterns are found:
- `requirements.txt` - main dependencies
- `dev-requirements.txt` - development dependencies ✨
- `test-requirements.txt` - testing dependencies ✨
- `docs-requirements.txt` - documentation dependencies ✨
- `prod-requirements.txt` - production dependencies ✨
- Any other `*requirements*.txt` variant ✨

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Missing requirements file in workspace dependencies
list</issue_title>
> <issue_description>I have the following file structure 
> 
>
![Image](https://github.com/user-attachments/assets/fccc626f-dedd-4c6e-8d66-93b7fc47ec6e)
> 
> - click + on venv in environments panel 
> - click to create environment in root directory
> - custom environment
> - install workspace dependencies
> - I only see `requirements.txt` as an option
> 
> I expect I would see both dev-requirements.txt and requirements.txt
because they are both present in the root folder
> 
> 
>
![Image](https://github.com/user-attachments/assets/0868fe35-f0c1-4b38-bf50-e40d7835a4f2)
> 
> </issue_description>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> <comment_new><author>@eleanorjboyd</author><body>
> todo: adopt dev-requirements.txt as something we search in the python
environment extension when finding dependency
files.</body></comment_new>
> </comments>
> 


</details>

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: eleanorjboyd <[email protected]>
Implementing better PowerShell version logging for activation debugging
as requested in issue #706.

The issue stems from the PR review comment
(microsoft/vscode-python-environments#693 (comment))
suggesting that logging PowerShell version information would be valuable
for debugging activation failures, especially given the differences
between Windows PowerShell 5.x and PowerShell 7+.

## Changes Made:
- [x] Analyze current PowerShell activation flow in pwshStartup.ts and
pwshEnvs.ts
- [x] Examine existing logging patterns and utilities
- [x] Test current build/compile state of project
- [x] Create utility function to detect PowerShell version via
`$PSVersionTable.PSVersion.Major`
- [x] Add PowerShell version logging to relevant activation code paths
- [x] Add version logging for both conda and non-conda activation
scenarios
- [x] Ensure logging follows existing patterns (traceInfo/traceVerbose)
- [x] Test changes and verify proper logging output
- [x] Use shorter -c flag instead of -Command for PowerShell commands

## Implementation Details:
1. **Added `getPowerShellVersion()` function** - Detects PowerShell
major version using `$PSVersionTable.PSVersion.Major` command with `-c`
flag
2. **Enhanced installation logging** - Now logs PowerShell version when
shells are detected (e.g., "SHELL: pwsh is installed (version 7)")
3. **Enhanced activation script error messages** - PowerShell errors now
include version info (e.g., "Failed to activate Python environment
(PowerShell 7): error details")

## Testing:
- All existing unit tests pass (128 passing)
- Code compiles successfully with no lint errors
- Manual testing confirms PowerShell version detection works correctly

These changes provide better diagnostic information for debugging
PowerShell activation issues without affecting existing functionality.

Fixes #706.

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ) to start
the survey.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: eleanorjboyd <[email protected]>
This would incur less notification for change in user profile rather try
to wait for shell integration not too long(max 0.5 second, but more
commonly earlier since shell integration would be ready before then), we
were already taking similar approach in some part of the code, but not
all.
Resolves:
microsoft/vscode-python-environments#919 which
will improve on top of
microsoft/vscode-python-environments#915

I want to bulletproof shell startup as much as possible. 
We shouldn't be showing profile modification prompt if user has shell
integration.

We should also ensure proper clean up.
This PR adds comprehensive unit test coverage for the `execUtils.ts`
utility functions that handle argument quoting for command execution.

## Overview

The `execUtils.ts` module contains two utility functions used throughout
the extension:
- `quoteStringIfNecessary(arg: string)`: Adds quotes around strings
containing spaces (unless already quoted)
- `quoteArgs(args: string[])`: Maps the quoting function over an array
of arguments

These functions are critical for properly escaping command-line
arguments, especially on Windows where paths often contain spaces (e.g.,
`C:\Program Files\Python`).

## Test Coverage Added

Created `src/test/features/execution/execUtils.unit.test.ts` with **25
comprehensive tests**:

### `quoteStringIfNecessary` tests (15 tests):
- ✅ Strings without spaces remain unquoted
- ✅ Strings with spaces get properly quoted
- ✅ Already-quoted strings are not double-quoted
- ✅ Edge cases: empty strings, only spaces, leading/trailing spaces
- ✅ Partial quote handling (strings with quotes on one side only)
- ✅ Special characters and path separators

### `quoteArgs` tests (10 tests):
- ✅ Empty array handling
- ✅ Mixed quoted and unquoted arguments
- ✅ Command-line flag patterns (`--flag "value with spaces"`)
- ✅ Windows and Unix path handling
- ✅ Argument order preservation

## Testing Approach

Following the repository's testing workflow instructions:
- Used `*.unit.test.ts` naming convention for fast, isolated testing
- No mocking required (pure utility functions)
- Clear test names describing expected behavior
- Simple arrange-act-assert structure for maintainability

## Verification

All tests pass successfully:
```
✔ 25 passing (11ms)
```

Total test suite remains healthy: **170 tests passing** with no
regressions.

<!-- START COPILOT CODING AGENT SUFFIX -->



<details>

<summary>Original prompt</summary>

> write unit tests for this file- using the test instructions file
> 
> 
> 
> The user has attached the following files from their workspace:
> - src/features/execution/execUtils.ts
> 
> 


</details>
Created from VS Code via the [GitHub Pull
Request](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github)
extension.

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 Share your feedback on Copilot coding agent for the chance to win a
$200 gift card! Click
[here](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ) to start
the survey.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: eleanorjboyd <[email protected]>
@NguyenCuong1989 NguyenCuong1989 requested review from Copilot and removed request for Copilot October 23, 2025 22:18
@NguyenCuong1989 NguyenCuong1989 self-assigned this Oct 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.