Réparer l'interaction GitHub Copilot ↔ Terminal dans VS Code
Vous en avez marre que Copilot ne puisse pas exécuter de commandes dans vos terminaux ? Erreurs "Terminal ID disposed" en boucle ? Je suis passé par là. Voici la solution définitive.
Réparer l'interaction GitHub Copilot ↔ Terminal dans VS Code
> TL;DR : Si GitHub Copilot n'arrive pas à exécuter de commandes dans vos terminaux VS Code avec l'erreur "Terminal ID disposed", le problème vient probablement de votre terminal par défaut (WSL) ou d'un profil mal configuré. Solution : passer à PowerShell par défaut et corriger vos profils custom.
🐛 Le Problème
Vous travaillez avec GitHub Copilot dans VS Code, vous lui demandez d'exécuter une commande, et BAM :
ERROR: Terminal with ID 4 does not exist (has it already been disposed?)Ou pire, votre profil "Python venv" plante avec un exit code 1.
Frustration level : 💯
🔍 Diagnostic : Pourquoi Ça Arrive ?
Cause #1 : WSL comme Terminal Par Défaut
GitHub Copilot a des difficultés d'interaction avec WSL. Les IDs de terminaux changent, les commandes se perdent.
Cause #2 : Profils Terminaux Incompatibles
CMD essayant d'exécuter un script PowerShell = incompatibilité totale.
✅ La Solution (Testée et Approuvée)
Étape 1 : PowerShell par Défaut
{
"terminal.integrated.defaultProfile.windows": "PowerShell"
}Pourquoi PowerShell ?
- ✅ Compatibilité parfaite avec Copilot
- ✅ Support natif scripts Python
- ✅ IDs terminaux stables
Étape 2 : Profil Python Corrigé
{
"terminal.integrated.profiles.windows": {
"Python PowerShell": {
"path": "powershell.exe",
"args": [
"-NoExit",
"-Command",
"& 'D:\\Projets\\mon-projet\\.venv\\Scripts\\Activate.ps1'"
],
"icon": "python"
}
}
}Points clés :
powershell.exeau lieu decmd.exe-NoExitpour garder le terminal ouvert- Chemin absolu vers
Activate.ps1
🎯 Ordre de Préférence des Shells
- 🥇 PowerShell - Fonctionne parfaitement
- 🥈 Git Bash - Alternative fiable
- 🥉 Python PowerShell - Si besoin venv activé
- ❌ WSL - Éviter pour Copilot (gardez-le pour usage manuel)
🧪 Vérification
- Fermez tous les terminaux VS Code
- Rechargez la fenêtre :
Ctrl+Shift+P→ "Developer: Reload Window" - Ouvrez un nouveau terminal
- Testez Copilot : Demandez-lui d'exécuter
Get-Location
Aucune erreur "Terminal ID disposed" ! 🎉
---
Cette galère de "Terminal ID disposed" m'a fait perdre des heures de productivité. J'espère que ce guide vous évitera cette frustration.
Des questions ? Essayez [DockSky](https://docksky.fr) pour héberger vos projets Docker sans ces galères de config locale 😉