Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Document per-file interpreter resolution in the config middleware
Clarify why the workspace/configuration handler resolves the interpreter for the exact .py file (exactResource) rather than its folder: it honors a per-file environment such as a PEP 723 inline-script env for the language client this extension hosts, and only diverges from folder resolution when the Python Environments extension is in use.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
StellaHuang95 and Copilot committed Aug 31, 2026
commit 64b462d2b92d28ada652fcd98540b692a595589b
5 changes: 5 additions & 0 deletions src/client/activation/languageClientMiddlewareBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ export class LanguageClientMiddlewareBase implements Middleware {
const settingDict: LSPObject & { pythonPath: string; _envPYTHONPATH: string } = settings[
i
] as LSPObject & { pythonPath: string; _envPYTHONPATH: string };
// For a .py file resource, resolve the interpreter for that exact file rather than its
// containing workspace folder, so a per-file environment (such as a PEP 723 inline-script
// environment created for a single script) is honored for the language client hosted by
// this extension. This only diverges from workspace-folder resolution when the Python
// Environments extension is in use; otherwise getActiveInterpreter ignores exactResource.
const exactResource = uri && path.extname(uri.fsPath).toLowerCase() === '.py';
settingDict.pythonPath =
(
Expand Down