Skip to content

Commit 25e3eb6

Browse files
committed
I think this would be the best approach once we shouldn't change the public dap.
1 parent 256c45c commit 25e3eb6

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

src/adapter/debugAdapter.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ import { VariableStore } from './variableStore';
3939

4040
const localize = nls.loadMessageBundle();
4141

42-
export interface DapCapabilitiesExtended extends Dap.Capabilities {
43-
supportsDebuggerProperties?: boolean;
44-
}
4542
// This class collects configuration issued before "launch" request,
4643
// to be applied after launch.
4744
export class DebugAdapter implements IDisposable {
@@ -168,7 +165,7 @@ export class DebugAdapter implements IDisposable {
168165
return capabilities;
169166
}
170167

171-
static capabilities(): DapCapabilitiesExtended {
168+
static capabilities(): Dap.CapabilitiesExtended {
172169
return {
173170
supportsConfigurationDoneRequest: true,
174171
supportsFunctionBreakpoints: false,

src/build/dapCustom.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,34 @@ const dapCustom: JSONSchema4 = {
578578
description:
579579
'Arguments for "setDebuggerProperty" request. Properties are determined by debugger.',
580580
},
581+
582+
...makeRequest(
583+
'capabilitiesExtended',
584+
'The event indicates that one or more capabilities have changed.',
585+
{
586+
properties: {
587+
params: {
588+
$ref: '#/definitions/CapabilitiesExtended',
589+
},
590+
},
591+
required: ['params'],
592+
},
593+
),
594+
595+
CapabilitiesExtended: {
596+
allOf: [
597+
{ $ref: '#/definitions/Capabilities' },
598+
{
599+
type: 'object',
600+
description: 'Extension of Capabilities defined in public DAP',
601+
properties: {
602+
supportsDebuggerProperties: {
603+
type: 'boolean',
604+
},
605+
},
606+
},
607+
],
608+
},
581609
},
582610
};
583611

src/dap/api.d.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,20 @@ export namespace Dap {
11131113
setDebuggerPropertyRequest(
11141114
params: SetDebuggerPropertyParams,
11151115
): Promise<SetDebuggerPropertyResult>;
1116+
1117+
/**
1118+
* The event indicates that one or more capabilities have changed.
1119+
*/
1120+
on(
1121+
request: 'capabilitiesExtended',
1122+
handler: (params: CapabilitiesExtendedParams) => Promise<CapabilitiesExtendedResult | Error>,
1123+
): () => void;
1124+
/**
1125+
* The event indicates that one or more capabilities have changed.
1126+
*/
1127+
capabilitiesExtendedRequest(
1128+
params: CapabilitiesExtendedParams,
1129+
): Promise<CapabilitiesExtendedResult>;
11161130
}
11171131

11181132
export interface TestApi {
@@ -1858,6 +1872,11 @@ export namespace Dap {
18581872
* Sets debugger properties.
18591873
*/
18601874
setDebuggerProperty(params: SetDebuggerPropertyParams): Promise<SetDebuggerPropertyResult>;
1875+
1876+
/**
1877+
* The event indicates that one or more capabilities have changed.
1878+
*/
1879+
capabilitiesExtended(params: CapabilitiesExtendedParams): Promise<CapabilitiesExtendedResult>;
18611880
}
18621881

18631882
export interface AttachParams {
@@ -1940,6 +1959,12 @@ export namespace Dap {
19401959
capabilities: Capabilities;
19411960
}
19421961

1962+
export interface CapabilitiesExtendedParams {
1963+
params: CapabilitiesExtended;
1964+
}
1965+
1966+
export interface CapabilitiesExtendedResult {}
1967+
19431968
export interface CompletionsParams {
19441969
/**
19451970
* Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope.
@@ -4611,6 +4636,10 @@ export namespace Dap {
46114636
*/
46124637
export type CompletionItemType = string;
46134638

4639+
export interface CapabilitiesExtended extends Capabilities {
4640+
supportsDebuggerProperties?: boolean;
4641+
}
4642+
46144643
/**
46154644
* Information about the capabilities of a debug adapter.
46164645
*/

src/dap/telemetryClassification.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,6 @@ interface IDAPOperationClassification {
132132
'!setsourcemapstepping.errors': { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth' };
133133
setdebuggerproperty: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth' };
134134
'!setdebuggerproperty.errors': { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth' };
135+
capabilitiesextended: { classification: 'SystemMetaData'; purpose: 'PerformanceAndHealth' };
136+
'!capabilitiesextended.errors': { classification: 'CallstackOrException'; purpose: 'PerformanceAndHealth' };
135137
}

0 commit comments

Comments
 (0)