@@ -55,10 +55,10 @@ class KotlinDebugAdapter(
55
55
56
56
override fun initialize (args : InitializeRequestArguments ): CompletableFuture <Capabilities > = async.compute {
57
57
converter.lineConverter = LineNumberConverter (
58
- externalLineOffset = if (args.linesStartAt1) 0L else - 1L
58
+ externalLineOffset = if (args.linesStartAt1) 0 else - 1
59
59
)
60
60
converter.columnConverter = LineNumberConverter (
61
- externalLineOffset = if (args.columnsStartAt1) 0L else - 1L
61
+ externalLineOffset = if (args.columnsStartAt1) 0 else - 1
62
62
)
63
63
64
64
val capabilities = Capabilities ()
@@ -135,7 +135,7 @@ class KotlinDebugAdapter(
135
135
val eventBus = debuggee.eventBus
136
136
eventBus.exitListeners.add {
137
137
// TODO: Use actual exitCode instead
138
- sendExitEvent(0L )
138
+ sendExitEvent(0 )
139
139
}
140
140
eventBus.breakpointListeners.add {
141
141
sendStopEvent(it.threadID, StoppedEventArgumentsReason .BREAKPOINT )
@@ -175,20 +175,20 @@ class KotlinDebugAdapter(
175
175
private fun sendThreadEvent (threadId : Long , reason : String ) {
176
176
client!! .thread(ThreadEventArguments ().also {
177
177
it.reason = reason
178
- it.threadId = threadId
178
+ it.threadId = threadId.toInt()
179
179
})
180
180
}
181
181
182
182
private fun sendStopEvent (threadId : Long , reason : String ) {
183
183
client!! .stopped(StoppedEventArguments ().also {
184
184
it.reason = reason
185
- it.threadId = threadId
185
+ it.threadId = threadId.toInt()
186
186
})
187
187
}
188
188
189
189
private fun sendExitEvent (exitCode : Long ) {
190
190
client!! .exited(ExitedEventArguments ().also {
191
- it.exitCode = exitCode
191
+ it.exitCode = exitCode.toInt()
192
192
})
193
193
client!! .terminated(TerminatedEventArguments ())
194
194
LOG .info(" Sent exit event" )
@@ -284,7 +284,7 @@ class KotlinDebugAdapter(
284
284
}
285
285
286
286
override fun continue_ (args : ContinueArguments ) = async.compute {
287
- var success = debuggee!! .threadByID(args.threadId)?.resume() ? : false
287
+ var success = debuggee!! .threadByID(args.threadId.toLong() )?.resume() ? : false
288
288
var allThreads = false
289
289
290
290
if (! success) {
@@ -296,7 +296,7 @@ class KotlinDebugAdapter(
296
296
if (success) {
297
297
exceptionsPool.clear()
298
298
converter.variablesPool.clear()
299
- converter.stackFramePool.removeAllOwnedBy(args.threadId)
299
+ converter.stackFramePool.removeAllOwnedBy(args.threadId.toLong() )
300
300
}
301
301
302
302
ContinueResponse ().apply {
@@ -305,15 +305,15 @@ class KotlinDebugAdapter(
305
305
}
306
306
307
307
override fun next (args : NextArguments ) = async.execute {
308
- debuggee!! .threadByID(args.threadId)?.stepOver()
308
+ debuggee!! .threadByID(args.threadId.toLong() )?.stepOver()
309
309
}
310
310
311
311
override fun stepIn (args : StepInArguments ) = async.execute {
312
- debuggee!! .threadByID(args.threadId)?.stepInto()
312
+ debuggee!! .threadByID(args.threadId.toLong() )?.stepInto()
313
313
}
314
314
315
315
override fun stepOut (args : StepOutArguments ) = async.execute {
316
- debuggee!! .threadByID(args.threadId)?.stepOut()
316
+ debuggee!! .threadByID(args.threadId.toLong() )?.stepOut()
317
317
}
318
318
319
319
override fun stepBack (args : StepBackArguments ): CompletableFuture <Void > = notImplementedDAPMethod()
@@ -326,10 +326,10 @@ class KotlinDebugAdapter(
326
326
327
327
override fun pause (args : PauseArguments ) = async.execute {
328
328
val threadId = args.threadId
329
- val success = debuggee!! .threadByID(threadId)?.pause()
329
+ val success = debuggee!! .threadByID(threadId.toLong() )?.pause()
330
330
if (success ? : false ) {
331
331
// If successful
332
- sendStopEvent(threadId,
332
+ sendStopEvent(threadId.toLong() ,
333
333
StoppedEventArgumentsReason .PAUSE
334
334
)
335
335
}
@@ -344,18 +344,18 @@ class KotlinDebugAdapter(
344
344
val threadId = args.threadId
345
345
return completedFuture(StackTraceResponse ().apply {
346
346
stackFrames = debuggee!!
347
- .threadByID(threadId)
347
+ .threadByID(threadId.toLong() )
348
348
?.stackTrace()
349
349
?.frames
350
- ?.map { converter.toDAPStackFrame(it, threadId) }
350
+ ?.map { converter.toDAPStackFrame(it, threadId.toLong() ) }
351
351
?.toTypedArray()
352
352
.orEmpty()
353
353
})
354
354
}
355
355
356
356
override fun scopes (args : ScopesArguments ) = completedFuture(
357
357
ScopesResponse ().apply {
358
- scopes = (converter.toInternalStackFrame(args.frameId)
358
+ scopes = (converter.toInternalStackFrame(args.frameId.toLong() )
359
359
? : throw KotlinDAException (" Could not find stackTrace with ID ${args.frameId} " ))
360
360
.scopes
361
361
.map(converter::toDAPScope)
@@ -366,6 +366,7 @@ class KotlinDebugAdapter(
366
366
override fun variables (args : VariablesArguments ) = completedFuture(
367
367
VariablesResponse ().apply {
368
368
variables = (args.variablesReference
369
+ .toLong()
369
370
.let (converter::toVariableTree)
370
371
? : throw KotlinDAException (" Could not find variablesReference with ID ${args.variablesReference} " ))
371
372
.childs
@@ -396,6 +397,7 @@ class KotlinDebugAdapter(
396
397
397
398
override fun evaluate (args : EvaluateArguments ): CompletableFuture <EvaluateResponse > = async.compute {
398
399
val variable = (args.frameId
400
+ .toLong()
399
401
.let (converter::toInternalStackFrame)
400
402
? : throw KotlinDAException (" Could not find stack frame with ID ${args.frameId} " ))
401
403
.evaluate(args.expression)
@@ -414,6 +416,7 @@ class KotlinDebugAdapter(
414
416
override fun completions (args : CompletionsArguments ): CompletableFuture <CompletionsResponse > = async.compute {
415
417
CompletionsResponse ().apply {
416
418
targets = (args.frameId
419
+ .toLong()
417
420
.let (converter::toInternalStackFrame)
418
421
? : throw KotlinDAException (" Could not find stack frame with ID ${args.frameId} " ))
419
422
.completions(args.text)
@@ -423,7 +426,7 @@ class KotlinDebugAdapter(
423
426
}
424
427
425
428
override fun exceptionInfo (args : ExceptionInfoArguments ): CompletableFuture <ExceptionInfoResponse > = async.compute {
426
- val id = exceptionsPool.getIDsOwnedBy(args.threadId).firstOrNull()
429
+ val id = exceptionsPool.getIDsOwnedBy(args.threadId.toLong() ).firstOrNull()
427
430
val exception = id?.let { exceptionsPool.getByID(it) }
428
431
ExceptionInfoResponse ().apply {
429
432
exceptionId = id?.toString() ? : " "
0 commit comments