-
-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathextension.ts
More file actions
33 lines (30 loc) · 1.39 KB
/
extension.ts
File metadata and controls
33 lines (30 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import * as vscode from 'vscode'
import { PhpDebugSession, StartRequestArguments } from './phpDebug'
export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.debug.onDidReceiveDebugSessionCustomEvent(event => {
if (event.event === 'newDbgpConnection') {
const config: vscode.DebugConfiguration & StartRequestArguments = {
...event.session.configuration,
}
config.request = 'launch'
config.name = 'DBGp connection ' + event.body.connId
config.connId = event.body.connId
vscode.debug.startDebugging(undefined, config)
}
})
)
const factory = new InlineDebugAdapterFactory()
context.subscriptions.push(vscode.debug.registerDebugAdapterDescriptorFactory('php', factory))
if ('dispose' in factory) {
context.subscriptions.push(factory)
}
}
class InlineDebugAdapterFactory implements vscode.DebugAdapterDescriptorFactory {
createDebugAdapterDescriptor(_session: vscode.DebugSession): vscode.ProviderResult<vscode.DebugAdapterDescriptor> {
// since DebugAdapterInlineImplementation is proposed API, a cast to <any> is required for now
const dap = new PhpDebugSession()
dap.setFromExtension(true)
return <any>new vscode.DebugAdapterInlineImplementation(dap)
}
}