Description
The ty.interpreter setting only partially expands VS Code variables. While ${env:USERNAME} expands correctly, ${workspaceFolderBasename} remains as a literal string, causing ty to fail finding the Python environment.
Steps to Reproduce
- Create a project with venv stored outside the project directory using a consistent naming pattern
- Add to
.vscode/settings.json:
{
"ty.interpreter": [
"C:\\Users\\${env:USERNAME}\\venv\\${workspaceFolderBasename}\\Scripts\\python.exe"
]
}
- Open the project in VS Code
- Check "ty: Show client logs" (Command Palette →
ty: Show client logs)
Expected Behavior
For a project named myproject with username john, the path should expand to:
C:\Users\john\venv\myproject\Scripts\python.exe
Both ${env:USERNAME} and ${workspaceFolderBasename} should be expanded.
Actual Behavior
The path expands to:
C:\Users\john\venv\${workspaceFolderBasename}\Scripts\python.exe
- ✅
${env:USERNAME} → john (works)
- ❌
${workspaceFolderBasename} → remains literal (doesn't work)
Log Evidence
Client log:
[error] Unable to find any Python environment for the interpreter path: C:\Users\john\venv\${workspaceFolderBasename}
Use Case / Motivation
Supporting team environments where developers store venvs outside the project directory with consistent naming:
C:\Users\alice\venv\project1\
C:\Users\alice\venv\project2\
C:\Users\bob\venv\project1\
C:\Users\bob\venv\project2\
Current Workaround
Must hardcode the project name in workspace settings (not ideal for shared configs):
{
"ty.interpreter": [
"C:\\Users\\${env:USERNAME}\\venv\\myproject\\Scripts\\python.exe"
]
}
This requires:
.vscode/settings.json to be gitignored
- Each team member to manually update their settings with their project name
- Maintaining a
.vscode/settings.json.example template
Environment
- ty-vscode version: 2026.4.0
- ty version: 0.0.12
- VS Code version: 1.108.0
- OS: Windows 10
- Python version: 3.13.7
Additional Context
This appears to be a common issue with VS Code extensions. Variable substitution is not automatic and must be implemented by each extension (VS Code issue #46471).
Description
The
ty.interpretersetting only partially expands VS Code variables. While${env:USERNAME}expands correctly,${workspaceFolderBasename}remains as a literal string, causing ty to fail finding the Python environment.Steps to Reproduce
.vscode/settings.json:{ "ty.interpreter": [ "C:\\Users\\${env:USERNAME}\\venv\\${workspaceFolderBasename}\\Scripts\\python.exe" ] }ty: Show client logs)Expected Behavior
For a project named
myprojectwith usernamejohn, the path should expand to:Both
${env:USERNAME}and${workspaceFolderBasename}should be expanded.Actual Behavior
The path expands to:
${env:USERNAME}→john(works)${workspaceFolderBasename}→ remains literal (doesn't work)Log Evidence
Client log:
Use Case / Motivation
Supporting team environments where developers store venvs outside the project directory with consistent naming:
Current Workaround
Must hardcode the project name in workspace settings (not ideal for shared configs):
{ "ty.interpreter": [ "C:\\Users\\${env:USERNAME}\\venv\\myproject\\Scripts\\python.exe" ] }This requires:
.vscode/settings.jsonto be gitignored.vscode/settings.json.exampletemplateEnvironment
Additional Context
This appears to be a common issue with VS Code extensions. Variable substitution is not automatic and must be implemented by each extension (VS Code issue #46471).