-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Modify getActiveEnvironmentPath()
API when resource
is passed as undefined
in a multiroot workspace
#21256
Comments
If I specify the interpreter the server starts, but then it doesn't use the environment |
@rdbisme Please provide logs from Output > Black Formatter. Also, provide path to the environment where you have installed black. |
I have a multiproject workspace, so I have a virtualenvironment selected per project.
|
@rdbisme Can you share your |
A sanitized version: {
"folders": [
{
"name": "****_prod",
"path": "****/src/****_prod"
},
{
"name": "****",
"path": "****"
},
{
"name": "qp",
"path": "****-deploy/src/qp"
},
{
"name": "****-strats-ci",
"path": "****-strats-ci"
},
{
"name": "xxxy0",
"path": "xxxy0"
},
{
"name": "****-ci",
"path": "****-ci"
},
{
"name": "backfill-ci",
"path": "****-deploy/src/backfill-ci"
},
{
"name": "internal-docs",
"path": "****-deploy/src/internal-docs"
},
{
"path": "****-api"
},
{
"path": "****-monitoring"
},
{
"path": "****-deploy/src/cmd-batch"
},
{
"path": "****-ui"
}
],
"settings": {
"yaml.schemas": {
"https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json": "file:///c%3A/Users/xxxxx/git/****-strats-ci/template-research-ci.yml"
}
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "Python: Debug Tests",
"type": "python",
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false,
"env": { "PYTEST_ADDOPTS": "--no-cov -v" }
}
],
"compounds": []
}
}
|
@rdbisme Can you share the logs from the python extension? Also, when you select interpreter for your multi root scenario did you select for the entire workspace or per root? |
I selected per root. And Intellisense and completions work as expected. Do you still need the logs? |
@rdbisme Can you select one for the entire workspace as well? and see if that helps. Another option is to add the interpreter here, (this is a temporary solution):
This is scenario that is not currently handled well. I will need to investigate what we can do to provide a better fix for this in these cases. |
That unfortunately doesn't work because I have different black versions requirements on different roots. |
The root cause if this seems to be same as microsoft/vscode-black-formatter#233 Closing this against that issue. |
@karthiknadig are you sure about this? I'm pretty confident this configuration was working before. The problem is that right now it requires an interpreter set up before starting. Also I have explicitly set up It stopped working very recently. |
I see. When you say recently was it in the last week? If it is last week, it could be due to python extension. You could revert python extension to 2023.6.1 and see if it helps. |
If none of that works, would it be possible for you to create a minimal repro with details on how and where you have environments. That will greatly help debug this. I tried creating a few different styles of multi-root repositories, I was not able to repro it. |
I have no environments, just the system-level Python, with Black installed with Windows 10 Python is installed for all users, it's in The notebooks work just fine with this Python interpreter. No environments. No workspace. I just start VSCode, open a folder, then open a Jupyter Notebook in that folder. I cannot format the notebook. The only recent change I'm aware of is the latest VSCode update to 1.78.2. I believe yesterday I was using the previous version.
|
@karrtikr We have not release a new version of the black extension in weeks, but seems like the ability to get python paths stopped working. Can you help investigate? @FlorinAndrei what is the version of VS Code, and Python extension you have installed? did you by change update VS Code or python extension recently |
VSCode 1.78.2 Yeah, today I've applied the update to the latest VSCode. Now the extension is not working anymore. It was working yesterday. I cannot think of any recent meaningful change other than the VSCode update. |
Success! Black Formatter v2022.6.0 works just fine. |
@FlorinAndrei I actually want you to revert Python extension to 2023.6.1... keep Black at 2023.2.0 |
Okay. Reverted Black Formatter to the latest version. Downgraded the Python extension in VSCode to version v2023.6.1 - and now Black Formatter works just fine. Re-updated the Python extension to the latest v2023.8.0 and Black Formatter still works just fine. I now have all VSCode extensions updated to the latest and the formatter is working. I cannot reproduce the issue anymore. |
Tested: Reverting Python extension to v2023.6.1 doesn't change the behaviour:
Reverting VScode to 1.77.3 also doesn't fix for me. Reverting the Black formatter extension to
The problem seems black extension to me @karthiknadig |
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off. Happy Coding! |
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off. Happy Coding! |
This is mitigated in the black-formatter extension. Keeping this open to get a solution in general for these scenarios. |
Discussing offline, but I think the right solution is to use https://github.com/microsoft/vscode-python/wiki/Python-Environment-APIs#get-current-known-environments to get all environments in the workspace and choose any one to launch LSP. What is the expectation from the API when passing |
Note passing |
Summary:For multi root scenarios, when no resource is passed into
"Auto-selected workspace environment" is defined as the preferred environment in the union of environments discovered in the following scopes:
|
getActiveEnvironmentPath()
API when resource
is passed as undefined
in a multiroot workspace
Type: Bug
Behaviour
Black server doesn't start because it requires an interpreter configured, even if
"black-formatter.importStrategy": "fromEnvironment"
.Expected vs. Actual
It should use the environment python as interpreter if
fromEnvironment
is setup and not require the additional setting.Steps to reproduce:
Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2023.2.0
VS Code version: Code 1.78.1 (6a995c4f4cc2ced6e3237749973982e751cb0bf9, 2023-05-04T09:48:08.683Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Sandboxed: Yes
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: