Skip to content

Modify getActiveEnvironmentPath() API when resource is passed as undefined in a multiroot workspace #21256

Open
@rdbisme

Description

@rdbisme

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:

  1. Open a python file
  2. Black doesn't start because of missing interpreter

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): venv
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

User Settings
{
  "workbench.tree.indent": 15,
  "terminal.integrated.profiles.windows": {
    "Git Bash (Scoop)": {
      "path": "C:\\Users\\xxxx\\scoop\\apps\\git\\current\\bin\\bash.exe",
      "args": ["--login"]
    },
    "UCRT64": {
      "path": "C:\\Users\\xxxx\\scoop\\apps\\msys2\\current\\usr\\bin\\bash.exe",
      "args": ["--login", "-i"],
      "env": {
        "MSYSTEM": "UCRT64",
        "CHERE_INVOKING": "1",
        "MSYS2_PATH_TYPE": "inherit"
      }
    },

    "MINGW64": {
      "path": "C:\\Users\\xxxx\\scoop\\apps\\msys2\\current\\usr\\bin\\bash.exe",
      "args": ["--login", "-i"],
      "env": {
        "MSYSTEM": "MINGW64",
        "CHERE_INVOKING": "1",
        "MSYS2_PATH_TYPE": "inherit"
      }
    }
  },
  "workbench.colorTheme": "Solarized Dark+",
  "python.defaultInterpreterPath": "C:\\Users\\xxxx\\scoop\\shims\\python3",
  "python.venvPath": "C:\\Users\\xxxx\\AppData\\Local\\pypoetry\\Cache\\virtualenvs",
  "python.formatting.provider": "none",
  "editor.formatOnSave": true,
  "isort.args": ["--profile", "black"],
  "[python]": {
    "editor.defaultFormatter": "ms-python.black-formatter",
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    },
    "editor.formatOnType": true
  },
  "[terraform]": {
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "hashicorp.terraform",
    "editor.tabSize": 2 // optionally
  },
  "python.analysis.logLevel": "Error",
  "terminal.integrated.defaultProfile.windows": "UCRT64",
  "editor.rulers": [80, 120],
  "vim.useSystemClipboard": true,
  "vim.leader": ",",
  "vim.foldfix": true,
  "vim.normalModeKeyBindings": [
    {
      "before": ["<leader>", "r"],
      "commands": ["editor.action.rename"]
    },
    {
      "before": ["<leader>", "R"],
      "commands": ["editor.action.refactor"]
    },
    {
      "before": ["<leader>", "d"],
      "commands": ["editor.action.revealDefinition"]
    },
    {
      "before": ["<leader>", "t"],
      "commands": ["editor.action.goToTypeDefinition"]
    }
  ],
  "diffEditor.ignoreTrimWhitespace": false,
  "editor.fontFamily": "MesloLGM NF, Consolas, 'Courier New', monospace, 'Segoe UI Emoji'",
  "rust-client.rustupPath": "C:\\Users\\xxxx\\scoop\\persist\\rustup\\.cargo\\bin\\rustup.exe",
  "security.workspace.trust.untrustedFiles": "open",
  "jupyter.askForKernelRestart": false,
  "terminal.integrated.fontFamily": "MesloLGM NF",
  "terminal.integrated.fontWeightBold": "bold",
  "editor.fontSize": 13,
  "explorer.confirmDelete": false,
  "[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "vim.neovimConfigPath": "C:\\Users\\xxxx\\scoop\\shims\\nvim",
  "vim.enableNeovim": true,
  "remote.SSH.path": "C:\\Users\\xxxx\\scoop\\apps\\msys2\\current\\usr\\bin\\ssh.exe",
  "redhat.telemetry.enabled": true,
  "workbench.editorAssociations": {
    "git-rebase-todo": "default"
  },
  "[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[yaml]": {
    "editor.defaultFormatter": "redhat.vscode-yaml"
  },
  "http.proxyStrictSSL": true,
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "black-formatter.importStrategy": "fromEnvironment",
  "black-formatter.interpreter": [
    "C:\\Users\\xxxx\\scoop\\shims\\python.exe"
  ],
  "git.openRepositoryInParentFolders": "never",
  "window.zoomLevel": -1,
  "[nginx]": {
    "editor.defaultFormatter": "ahmadalli.vscode-nginx-conf"
  }
}

Multiroot scenario, following user settings may not apply:

venvPath: "<placeholder>"

languageServer: "Pylance"

formatting
• provider: "none"

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
Item Value
CPUs Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 x 3192)
GPU Status 2d_canvas: enabled
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
Load (avg) undefined
Memory (System) 31.85GB (15.06GB free)
Process Argv --enable-proposed-api genuitecllc.codetogether --crash-reporter-id ed01675f-67d1-4c85-8363-79de19e446c3
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
nodejswelcome1cf:30587006
3biah626:30602489
pyind779:30671433
f6dab269:30613381
pythonsymbol12:30671437
vsctsb:30705553
azdwalk:30687957
pythonms35:30701012
pythonclientmvcf:30708686

Metadata

Metadata

Assignees

Labels

area-apiAPI related issuesarea-environmentsFeatures relating to handling interpreter environmentsdebtCovers everything internal: CI, testing, refactoring of the codebase, etc.needs PRReady to be worked on

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions