| 397 | } |
| 398 | } |
| 399 | |
| 400 | |
| 401 | abstract class CompletionResult(private val status: CompletionStatus) { |
| 402 | // open fun toJson(): JsonObject { |
| 403 | // return jsonObject("status" to status.toString()) |
| 404 | // } |
| 405 | |
| 406 | open class Success( |
| 407 | val matches: List<String>, |
| 408 | val bounds: CompletionTokenBounds, |
| 409 | val metadata: List<SourceCodeCompletionVariant>, |
| 410 | val text: String, |
| 411 | val cursor: Int |
| 412 | ) : CompletionResult(CompletionStatus.OK) { |
| 413 | init { |
| 414 | assert(matches.size == metadata.size) |
| 415 | } |
| 416 | |
| 417 | // override fun toJson(): JsonObject { |
| 418 | // val res = super.toJson() |
| 419 | // res["matches"] = matches |
| 420 | // res["cursor_start"] = bounds.start |
| 421 | // res["cursor_end"] = bounds.end |
| 422 | // res["metadata"] = mapOf( |
| 423 | // "_jupyter_types_experimental" to metadata.map { |
| 424 | // mapOf( |
| 425 | // "text" to it.text, |
| 426 | // "type" to it.tail, |
| 427 | // "start" to bounds.start, |
| 428 | // "end" to bounds.end |
| 429 | // ) |
| 430 | // }, |
| 431 | // "_jupyter_extended_metadata" to metadata.map { |
| 432 | // mapOf( |
| 433 | // "text" to it.text, |
| 434 | // "displayText" to it.displayText, |
nothing calls this directly
no test coverage detected