Skip to content

Commit 4962bd2

Browse files
committed
Prettier.
1 parent 37bc38f commit 4962bd2

File tree

2 files changed

+41
-42
lines changed

2 files changed

+41
-42
lines changed

src/extension.ts

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,50 @@
11
import * as vscode from 'vscode'
2-
import { PhpDebugSession} from './phpDebug'
2+
import { PhpDebugSession } from './phpDebug'
33

44
export 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

3541
export function deactivate() {
3642
console.log('deactivate')
3743
}
3844

3945
class 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+
}

src/phpDebug.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ class NewDbgpConnectionEvent extends vscode.Event {
5151
connId: number
5252
}
5353
constructor(connId: number) {
54-
super('newDbgpConnection');
54+
super('newDbgpConnection')
5555
this.body = {
56-
connId: connId
56+
connId: connId,
5757
}
5858
}
5959
}
@@ -207,8 +207,8 @@ export class PhpDebugSession extends vscode.DebugSession {
207207
response: VSCodeDebugProtocol.AttachResponse,
208208
args2: VSCodeDebugProtocol.AttachRequestArguments
209209
) {
210-
const args = args2 as LaunchRequestArguments
211-
if (!args.connId || !PhpDebugSession._allConnections.has(args.connId)) {
210+
const args = args2 as LaunchRequestArguments
211+
if (!args.connId || !PhpDebugSession._allConnections.has(args.connId)) {
212212
this.sendErrorResponse(response, new Error('Cant find connection'))
213213
this.shutdown()
214214
return
@@ -217,7 +217,7 @@ export class PhpDebugSession extends vscode.DebugSession {
217217

218218
this._args = args
219219
const connection = PhpDebugSession._allConnections.get(args.connId!)!
220-
220+
221221
this._connections.set(connection.id, connection)
222222
this._waitingConnections.add(connection)
223223
const disposeConnection = (error?: Error) => {
@@ -226,11 +226,7 @@ export class PhpDebugSession extends vscode.DebugSession {
226226
this.sendEvent(new vscode.OutputEvent('connection ' + connection.id + ' closed\n'))
227227
}
228228
if (error) {
229-
this.sendEvent(
230-
new vscode.OutputEvent(
231-
'connection ' + connection.id + ': ' + error.message + '\n'
232-
)
233-
)
229+
this.sendEvent(new vscode.OutputEvent('connection ' + connection.id + ': ' + error.message + '\n'))
234230
}
235231
this.sendEvent(new vscode.ContinuedEvent(connection.id, false))
236232
this.sendEvent(new vscode.ThreadEvent('exited', connection.id))
@@ -257,9 +253,7 @@ export class PhpDebugSession extends vscode.DebugSession {
257253
)
258254
)
259255
} catch (error) {
260-
throw new Error(
261-
'Error applying xdebugSettings: ' + (error instanceof Error ? error.message : error)
262-
)
256+
throw new Error('Error applying xdebugSettings: ' + (error instanceof Error ? error.message : error))
263257
}
264258

265259
this.sendEvent(new vscode.ThreadEvent('started', connection.id))

0 commit comments

Comments
 (0)