-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Bug Report: WSL Detection Fails on Non-English Windows Systems
Summary
The Codacy VS Code extension fails to detect WSL on non-English Windows systems because it checks for the English string "Default Distribution" in wsl --status output, which is localized.
Environment
- OS: Windows 11 (German locale: de-DE)
- VS Code Version: 1.96+
- Codacy Extension Version: 1.11.7
- WSL Version: 2
- WSL Distribution: Ubuntu (Running, Default)
Steps to Reproduce
- Install Windows with a non-English locale (e.g., German)
- Install WSL 2 with Ubuntu as default distribution
- Install Codacy VS Code extension
- Extension fails to detect WSL, MCP server doesn't start automatically
Expected Behavior
The extension should detect WSL regardless of Windows display language.
Actual Behavior
WSL detection fails because wsl --status returns localized output.
English Windows Output:
Default Distribution: Ubuntu
Version: 2
German Windows Output:
Standarddistribution: Ubuntu
Version: 2
Root Cause
In src/cli/index.ts, the detection logic uses:
stdout.includes('Default Distribution')This only works on English Windows systems.
Suggested Fix
Use a locale-independent detection method:
Option 1: Use wsl -l -q (quiet mode, no localized text)
const { stdout } = await execAsync('wsl -l -q');
const hasDistributions = stdout.trim().length > 0;Option 2: Check multiple locale strings
const wslIndicators = [
'Default Distribution', // English
'Standarddistribution', // German
'Distribution par défaut', // French
'Distribución predeterminada', // Spanish
// ... other locales
];
const hasWsl = wslIndicators.some(indicator => stdout.includes(indicator));Option 3: Use registry or PowerShell (most reliable)
// Check if any WSL distribution exists
const { stdout } = await execAsync('wsl --list --quiet 2>nul');
const hasWsl = stdout.trim().split('\n').filter(Boolean).length > 0;Workaround
Users can manually configure the MCP server in VS Code settings:
{
"mcp.servers": {
"codacy": {
"type": "stdio",
"command": "wsl",
"args": ["-d", "Ubuntu", "--", "npx", "-y", "@codacy/codacy-mcp"]
}
}
}Impact
- All non-English Windows users with WSL cannot use the automatic WSL detection
- Affects German, French, Spanish, Portuguese, Chinese, Japanese, and many other locales
- Users must manually configure MCP server or use native Windows installation
Additional Context
Tested and confirmed working with manual configuration:
- Node.js 20.19.6 in WSL Ubuntu
npx -y @codacy/codacy-mcpstarts successfully- MCP server responds correctly: "Codacy MCP Server running on stdio"
Submitted by: Peter Schuller
Date: 2025-12-02
Metadata
Metadata
Assignees
Labels
No labels