You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Show the snake icon on extension-created Python terminal REPLs (#26141)
<img width="2113" height="494" alt="image"
src="https://github.com/user-attachments/assets/7dc82d66-60ca-43e8-9cc1-9d3fa44e1a25"
/>
Fixes#21996
Terminal REPLs launched by the extension only set a title, so VS Code
fell back to the default shell/profile icon. This threads an optional
`iconPath` through the terminal creation pipeline and sets
`ThemeIcon('snake')` for the REPL only.
### Changes
- **`common/terminal/types.ts`**: `TerminalCreationOptions` gains
`iconPath?: TerminalOptions['iconPath']`, keeping the internal type
aligned with the VS Code API.
- **`common/terminal/service.ts`**: `ensureTerminal` forwards `iconPath`
on both creation paths — `ensureTerminalLegacy(...)` (env extension,
whose options extend `TerminalOptions`) and
`terminalManager.createTerminal(...)`.
- **`terminals/codeExecution/terminalCodeExecution.ts`**: new `protected
terminalIcon?: TerminalOptions['iconPath']`, passed to
`terminalServiceFactory.getTerminalService(...)` alongside the title.
- **`terminals/codeExecution/repl.ts`**: sets the icon, so plain Python
terminals, Django shells, native REPL tabs, and user-typed `python`
sessions are untouched.
```ts
// repl.ts
this.terminalTitle = 'REPL';
this.terminalIcon = new ThemeIcon('snake');
```
### Tests
- `terminalCodeExec.unit.test.ts`: the title matcher now also asserts
the expected icon id per suite — `snake` for `ReplProvider`, none for
the Terminal and Django providers.
- `service.unit.test.ts`: two tests assert `iconPath` reaches
`terminalManager.createTerminal(...)` and, with `useEnvExtension()`
stubbed on, `ensureTerminalLegacy(...)`.
The env-extension test stubs `ensureTerminalLegacy` with a plain object
rather than a TypeMoq mock: dynamic mocks answer any property access, so
`await`ing one hangs on the phantom `then`.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: edvilme <5952839+edvilme@users.noreply.github.com>
0 commit comments