Skip to content

Commit c9988aa

Browse files
authored
Custom event for radix notify (#534)
Sending a custom event to notify clients of radix changes, with the radix provided in the payload Related to eclipse-cdt-cloud/cdt-gdb-vscode#219
1 parent 26ddee1 commit c9988aa

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/gdb/GDBDebugSessionBase.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
Source,
2424
StackFrame,
2525
TerminatedEvent,
26+
Event,
2627
} from '@vscode/debugadapter';
2728
import { DebugProtocol } from '@vscode/debugprotocol';
2829
import { ContinuedEvent } from '../events/continuedEvent';
@@ -3072,6 +3073,11 @@ export abstract class GDBDebugSessionBase extends LoggingDebugSession {
30723073
private handleCmdParamChanged(notifyData: CmdParamChangedNotifyData) {
30733074
switch (notifyData.param) {
30743075
case 'output-radix':
3076+
this.sendEvent(
3077+
new Event('OutputRadixUpdated', {
3078+
radix: notifyData.value,
3079+
})
3080+
);
30753081
this.sendEvent(new InvalidatedEvent(['variables']));
30763082
break;
30773083
default:

src/integration-tests/evaluate.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,18 @@ describe('evaluate request', function () {
299299
expect(monitorVariable?.value).to.equal('10');
300300
});
301301

302-
it('should send invalidate event when changing global radix through evaluate request', async function () {
302+
it('should send a custom event and an invalidate event when changing global radix through evaluate request', async function () {
303303
const event = dc.waitForEvent('invalidated');
304+
const customEvent = dc.waitForEvent('OutputRadixUpdated');
304305
await dc.evaluateRequest({
305306
context: 'repl',
306307
expression: '> set output-radix 16',
307308
frameId: scope.frame.id,
308309
});
309310
const invalidatedEvent = await event;
311+
const outputRadixUpdatedEvent = await customEvent;
310312
expect(invalidatedEvent).to.be.not.undefined;
313+
expect(outputRadixUpdatedEvent.body.radix).eq('16');
311314
});
312315
});
313316

0 commit comments

Comments
 (0)