Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Dec 16, 2023
1 parent 4db437c commit 15683a0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ enum class CompletionType {
// TODO: support in future for this
AFTER_BLOCK_COMPLETION;

fun builder(context: JobContext): CodeContextBuilder<out Any> {
fun builder(context: JobContext): InstructionBuilder {
return mapOf(
INLINE_COMPLETION to InlineCodeCompletionBuilder(context),
IN_BLOCK_COMPLETION to InBlockCodeCompletionBuilder(context),
AFTER_BLOCK_COMPLETION to AfterBlockCodeCompletionBuilder(context),
)[this] ?: throw SerializationException("Unknown message type: $this")
}

fun builders(types: List<CompletionType>, context: JobContext) : List<InstructionBuilder> {
return types.map { it.builder(context) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ data class CodeCompletionIns(
}

interface InstructionBuilder {
fun buildDataStruct(dataStruct: CodeDataStruct): List<CodeCompletionIns> {
fun build(dataStruct: CodeDataStruct): List<CodeCompletionIns> {
return listOf()
}

fun buildFun(function: CodeFunction): List<CodeCompletionIns>
fun build(function: CodeFunction): List<CodeCompletionIns>
}


Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import chapi.domain.core.CodeFunction


class AfterBlockCodeCompletionBuilder(val context: JobContext) : InstructionBuilder {
override fun buildFun(function: CodeFunction): List<CodeCompletionIns> {
override fun build(function: CodeFunction): List<CodeCompletionIns> {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import cc.unitmesh.pick.prompt.JobContext
import chapi.domain.core.CodeFunction

class InBlockCodeCompletionBuilder(val context: JobContext) : InstructionBuilder {
override fun buildFun(function: CodeFunction): List<CodeCompletionIns> {
override fun build(function: CodeFunction): List<CodeCompletionIns> {
TODO("Not yet implemented")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import cc.unitmesh.pick.prompt.JobContext
import chapi.domain.core.CodeFunction

class InlineCodeCompletionBuilder(val context: JobContext) : InstructionBuilder {
override fun buildFun(function: CodeFunction): List<CodeCompletionIns> {
override fun build(function: CodeFunction): List<CodeCompletionIns> {
TODO("Not yet implemented")
}

Expand Down

0 comments on commit 15683a0

Please sign in to comment.