Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Substitute environment variables in extension settings #554

Merged
merged 1 commit into from
Jul 24, 2024
Merged

Conversation

dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Jul 23, 2024

Summary

This PR updates the resolveVariables to consider environment variables.

Reference: https://github.com/microsoft/vscode-black-formatter/blob/458ed8f03f03c6e021361b7dcf4a8c7ab7c3d5fb/src/common/settings.ts#L64-L71

fixes: #448

Test Plan

Note that you'll need to launch the VS Code from the shell so that the VS Code process can see the variables which are present in an activate virtual environment.

$ echo $VIRTUAL_ENV
/Users/dhruv/playground/ruff/.venv

$ code --extensionDevelopmentPath=/Users/dhruv/work/astral/ruff-vscode .

Using the following settings:

{
  "ruff.interpreter": ["${env:VIRTUAL_ENV}/bin/python"]
}

Logs:

2024-07-24 09:15:11.563 [info] Using interpreter: /Users/dhruv/playground/ruff/.venv/bin/python
2024-07-24 09:15:11.634 [info] Using the Ruff binary: /Users/dhruv/playground/ruff/.venv/bin/ruff
2024-07-24 09:15:11.640 [info] Resolved 'ruff.nativeServer: auto' to use the native server
2024-07-24 09:15:11.642 [info] Found Ruff 0.5.4 at /Users/dhruv/playground/ruff/.venv/bin/ruff
2024-07-24 09:15:11.642 [info] Server run command: /Users/dhruv/playground/ruff/.venv/bin/ruff server
2024-07-24 09:15:11.642 [info] Server: Start requested.

@dhruvmanila dhruvmanila force-pushed the dhruv/interpreter branch 4 times, most recently from 7e25f69 to dec965c Compare July 24, 2024 03:19
@dhruvmanila dhruvmanila marked this pull request as ready for review July 24, 2024 03:45
Base automatically changed from dhruv/interpreter to main July 24, 2024 04:35
@dhruvmanila dhruvmanila merged commit 7f92251 into main Jul 24, 2024
6 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/env branch July 24, 2024 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Environment variables are not expanded in "ruff.path" VSCode settings
2 participants