11import * as vscode from 'vscode'
2- import { PhpDebugSession } from './phpDebug'
2+ import { PhpDebugSession } from './phpDebug'
33
44export function activate ( context : vscode . ExtensionContext ) {
55 console . log ( 'activate' )
66
7- context . subscriptions . push ( vscode . debug . onDidStartDebugSession ( session => {
8- console . log ( 'onDidStartDebugSession' , session )
9- //session.customRequest('test1', { test2: "test3" })
10- } ) )
11- context . subscriptions . push ( vscode . debug . onDidTerminateDebugSession ( session => {
12- console . log ( 'onDidTerminateDebugSession' , session )
13- } ) )
7+ context . subscriptions . push (
8+ vscode . debug . onDidStartDebugSession ( session => {
9+ console . log ( 'onDidStartDebugSession' , session )
10+ //session.customRequest('test1', { test2: "test3" })
11+ } )
12+ )
13+ context . subscriptions . push (
14+ vscode . debug . onDidTerminateDebugSession ( session => {
15+ console . log ( 'onDidTerminateDebugSession' , session )
16+ } )
17+ )
1418
15- context . subscriptions . push ( vscode . debug . onDidReceiveDebugSessionCustomEvent ( event => {
16- console . log ( 'onDidReceiveDebugSessionCustomEvent' , event )
17- if ( event . event === 'newDbgpConnection' ) {
18- const config : vscode . DebugConfiguration = {
19- ...event . session . configuration
19+ context . subscriptions . push (
20+ vscode . debug . onDidReceiveDebugSessionCustomEvent ( event => {
21+ console . log ( 'onDidReceiveDebugSessionCustomEvent' , event )
22+ if ( event . event === 'newDbgpConnection' ) {
23+ const config : vscode . DebugConfiguration = {
24+ ...event . session . configuration ,
25+ }
26+ config . request = 'attach'
27+ config . name = 'DBGp connection ' + event . body . connId
28+ config . connId = event . body . connId
29+ vscode . debug . startDebugging ( undefined , config , event . session )
2030 }
21- config . request = 'attach'
22- config . name = 'DBGp connection ' + event . body . connId
23- config . connId = event . body . connId
24- vscode . debug . startDebugging ( undefined , config , event . session )
25- }
26- } ) )
31+ } )
32+ )
2733
2834 const factory = new InlineDebugAdapterFactory ( )
29- context . subscriptions . push ( vscode . debug . registerDebugAdapterDescriptorFactory ( 'php' , factory ) ) ;
30- if ( 'dispose' in factory ) {
31- context . subscriptions . push ( factory ) ;
32- }
35+ context . subscriptions . push ( vscode . debug . registerDebugAdapterDescriptorFactory ( 'php' , factory ) )
36+ if ( 'dispose' in factory ) {
37+ context . subscriptions . push ( factory )
38+ }
3339}
3440
3541export function deactivate ( ) {
3642 console . log ( 'deactivate' )
3743}
3844
3945class InlineDebugAdapterFactory implements vscode . DebugAdapterDescriptorFactory {
40-
41- createDebugAdapterDescriptor ( _session : vscode . DebugSession ) : vscode . ProviderResult < vscode . DebugAdapterDescriptor > {
42- // since DebugAdapterInlineImplementation is proposed API, a cast to <any> is required for now
43- return < any > new vscode . DebugAdapterInlineImplementation ( new PhpDebugSession ( ) ) ;
44- }
45- }
46+ createDebugAdapterDescriptor ( _session : vscode . DebugSession ) : vscode . ProviderResult < vscode . DebugAdapterDescriptor > {
47+ // since DebugAdapterInlineImplementation is proposed API, a cast to <any> is required for now
48+ return < any > new vscode . DebugAdapterInlineImplementation ( new PhpDebugSession ( ) )
49+ }
50+ }
0 commit comments