|
3 | 3 |
|
4 | 4 | import { inject, injectable } from 'inversify'; |
5 | 5 | import { Disposable, Event, EventEmitter, Terminal, Uri } from 'vscode'; |
| 6 | +import '../../common/extensions'; |
| 7 | +import { IInterpreterService } from '../../interpreter/contracts'; |
6 | 8 | import { IServiceContainer } from '../../ioc/types'; |
| 9 | +import { captureTelemetry } from '../../telemetry'; |
| 10 | +import { TERMINAL_CREATE } from '../../telemetry/constants'; |
7 | 11 | import { ITerminalManager } from '../application/types'; |
8 | 12 | import { sleep } from '../core.utils'; |
9 | | -import { IDisposableRegistry } from '../types'; |
| 13 | +import { IConfigurationService, IDisposableRegistry } from '../types'; |
10 | 14 | import { ITerminalHelper, ITerminalService, TerminalShellType } from './types'; |
11 | 15 |
|
12 | 16 | @injectable() |
@@ -74,11 +78,21 @@ export class TerminalService implements ITerminalService, Disposable { |
74 | 78 | } |
75 | 79 |
|
76 | 80 | this.terminal!.show(preserveFocus); |
| 81 | + |
| 82 | + this.sendTelemetry().ignoreErrors(); |
77 | 83 | } |
78 | 84 | private terminalCloseHandler(terminal: Terminal) { |
79 | 85 | if (terminal === this.terminal) { |
80 | 86 | this.terminalClosed.fire(); |
81 | 87 | this.terminal = undefined; |
82 | 88 | } |
83 | 89 | } |
| 90 | + |
| 91 | + private async sendTelemetry() { |
| 92 | + const pythonPath = this.serviceContainer.get<IConfigurationService>(IConfigurationService).getSettings(this.resource).pythonPath; |
| 93 | + const interpreterInfo = await this.serviceContainer.get<IInterpreterService>(IInterpreterService).getInterpreterDetails(pythonPath); |
| 94 | + const pythonVersion = interpreterInfo.version_info ? interpreterInfo.version_info.join('.') : undefined; |
| 95 | + const interpreterType = interpreterInfo.type; |
| 96 | + captureTelemetry(TERMINAL_CREATE, { terminal: this.terminalShellType, pythonVersion, interpreterType }); |
| 97 | + } |
84 | 98 | } |
0 commit comments