Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,14 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD
channelWriteEmitter: vscode.EventEmitter<string>,
][] = [];

createRttTerminal(channelNumber: number, dataFormat: string, channelName: string) {
createRttTerminal(
session: vscode.DebugSession | undefined,
channelNumber: number,
dataFormat: string,
channelName: string,
) {
// Make sure we have a terminal window per channel, for RTT Logging
if (vscode.debug.activeDebugSession) {
let session = vscode.debug.activeDebugSession;
if (session) {
let channelWriteEmitter = new vscode.EventEmitter<string>();
let channelPty: vscode.Pseudoterminal = {
onDidWrite: channelWriteEmitter.event,
Expand All @@ -163,6 +167,10 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD
});
},
close: () => {
let session = vscode.debug.activeDebugSession;
if (!session) {
return;
}
let windowIsOpen = false;
session
.customRequest('rttWindowOpened', {channelNumber, windowIsOpen})
Expand Down Expand Up @@ -232,6 +240,7 @@ class ProbeRSDebugAdapterServerDescriptorFactory implements vscode.DebugAdapterD
switch (customEvent.event) {
case 'probe-rs-rtt-channel-config':
this.createRttTerminal(
customEvent.session,
+customEvent.body?.channelNumber,
customEvent.body?.dataFormat,
customEvent.body?.channelName,
Expand Down
Loading