MCPcopy Create free account
hub / github.com/Snapchat/Valdi / customBreakpoints

Function customBreakpoints

valdi/vscode_debugger/src/adapter/customBreakpoints.ts:20–308  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18const map: Map<string, ICustomBreakpoint> = new Map();
19
20export function customBreakpoints(): Map<string, ICustomBreakpoint> {
21 if (map.size) return map;
22
23 const localize = nls.loadMessageBundle();
24
25 function g(group: string, breakpoints: ICustomBreakpoint[]) {
26 for (const b of breakpoints) {
27 b.group = group;
28 map.set(b.id, b);
29 }
30 }
31
32 function i(instrumentation: string, maybeTitle?: string): ICustomBreakpoint {
33 const title = maybeTitle || instrumentation;
34 return {
35 id: 'instrumentation:' + instrumentation,
36 title,
37 group: '',
38 // eslint-disable-next-line
39 details: (data: any): { short: string; long: string } => {
40 if (instrumentation === 'webglErrorFired') {
41 let errorName = data['webglErrorName'];
42 // If there is a hex code of the error, display only this.
43 errorName = errorName.replace(/^.*(0x[0-9a-f]+).*$/i, '$1');
44 return {
45 short: localize('breakpoint.webglErrorNamed', 'WebGL Error "{0}"', errorName),
46 long: localize(
47 'breakpoint.webglErrorNamedDetails',
48 'Paused on WebGL Error instrumentation breakpoint, error "{0}"',
49 errorName,
50 ),
51 };
52 }
53 if (instrumentation === 'scriptBlockedByCSP' && data['directiveText']) {
54 return {
55 short: localize(
56 'breakpoint.cspViolationNamed',
57 'CSP violation "{0}"',
58 data['directiveText'],
59 ),
60 long: localize(
61 'breakpoint.cspViolationNamedDetails',
62 'Paused on Content Security Policy violation instrumentation breakpoint, directive "{0}"',
63 data['directiveText'],
64 ),
65 };
66 }
67 return {
68 short: title,
69 long: localize(
70 'breakpoint.instrumentationNamed',
71 'Paused on instrumentation breakpoint "{0}"',
72 title,
73 ),
74 };
75 },
76 apply: async (cdp: Cdp.Api, enabled: boolean): Promise<boolean> => {
77 if (enabled)

Callers 3

constructorMethod · 0.90

Calls 3

gFunction · 0.70
iFunction · 0.70
eFunction · 0.70

Tested by

no test coverage detected