MCPcopy Create free account
hub / github.com/CodinGame/monaco-vscode-api / createDebugAdapterDescriptor

Function createDebugAdapterDescriptor

demo/src/features/debugger.ts:65–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63
64 debuggerVscodeApi.debug.registerDebugAdapterDescriptorFactory('javascript', {
65 async createDebugAdapterDescriptor() {
66 const websocket = new WebSocket('ws://localhost:5555')
67
68 await new Promise((resolve, reject) => {
69 websocket.onopen = resolve
70 websocket.onerror = () =>
71 reject(new Error('Unable to connect to debugger server. Run `npm run start:debugServer`'))
72 })
73
74 websocket.send(
75 JSON.stringify({
76 main: '/workspace/test.js',
77 files: {
78 '/workspace/test.js': new TextDecoder().decode(
79 await debuggerVscodeApi.workspace.fs.readFile(
80 debuggerVscodeApi.Uri.file('/workspace/test.js')
81 )
82 )
83 }
84 })
85 )
86
87 const adapter = new WebsocketDebugAdapter(websocket)
88
89 // eslint-disable-next-line @typescript-eslint/no-explicit-any
90 adapter.onDidSendMessage((message: any) => {
91 if (message.type === 'event' && message.event === 'output') {
92 console.log('OUTPUT', message.body.output)
93 }
94 })
95 return new debuggerVscodeApi.DebugAdapterInlineImplementation(adapter)
96 }
97 })
98})

Callers

nothing calls this directly

Calls 2

sendMethod · 0.80
readFileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…