-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
refactor: reorg for builder factory
Showing
12 changed files
with
37 additions
and
51 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
unit-picker/src/main/kotlin/cc/unitmesh/pick/builder/InsBuilderFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package cc.unitmesh.pick.builder | ||
|
||
import cc.unitmesh.core.completion.TypedInsBuilder | ||
import cc.unitmesh.core.completion.InstructionBuilderType | ||
import cc.unitmesh.pick.builder.comment.DocumentationTypedInsBuilder | ||
import cc.unitmesh.pick.builder.completion.AfterBlockCodeTypedInsBuilder | ||
import cc.unitmesh.pick.builder.completion.InBlockCodeTypedInsBuilder | ||
import cc.unitmesh.pick.builder.completion.InlineCodeTypedInsBuilder | ||
import cc.unitmesh.pick.builder.unittest.TestCodeTypedInsBuilder | ||
import cc.unitmesh.pick.worker.job.JobContext | ||
import kotlinx.serialization.SerializationException | ||
|
||
fun instructionBuilders(types: List<InstructionBuilderType>, context: JobContext) : List<TypedInsBuilder> { | ||
return types.map { instructionBuilder(it, context) } | ||
} | ||
|
||
fun instructionBuilder(instructionBuilderType: InstructionBuilderType, context: JobContext): TypedInsBuilder { | ||
return mapOf( | ||
InstructionBuilderType.INLINE_COMPLETION to InlineCodeTypedInsBuilder(context), | ||
InstructionBuilderType.IN_BLOCK_COMPLETION to InBlockCodeTypedInsBuilder(context), | ||
InstructionBuilderType.AFTER_BLOCK_COMPLETION to AfterBlockCodeTypedInsBuilder(context), | ||
InstructionBuilderType.TEST_CODE_GEN to TestCodeTypedInsBuilder(context), | ||
InstructionBuilderType.DOCUMENTATION to DocumentationTypedInsBuilder(context), | ||
)[instructionBuilderType] ?: throw SerializationException("Unknown message type: $instructionBuilderType") | ||
} |
38 changes: 0 additions & 38 deletions
38
unit-picker/src/main/kotlin/cc/unitmesh/pick/builder/InsBuilderUtil.kt
This file was deleted.
Oops, something went wrong.
3 changes: 1 addition & 2 deletions
3
...k/builder/DocumentationTypedInsBuilder.kt → ...r/comment/DocumentationTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../bizcode/AfterBlockCodeTypedInsBuilder.kt → ...mpletion/AfterBlockCodeTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...der/bizcode/InBlockCodeTypedInsBuilder.kt → .../completion/InBlockCodeTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lder/bizcode/InlineCodeTypedInsBuilder.kt → ...r/completion/InlineCodeTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...h/pick/builder/TestCodeTypedInsBuilder.kt → ...ilder/unittest/TestCodeTypedInsBuilder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...code/AfterBlockCodeTypedInsBuilderTest.kt → ...tion/AfterBlockCodeTypedInsBuilderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...bizcode/InBlockCodeTypedInsBuilderTest.kt → ...pletion/InBlockCodeTypedInsBuilderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../bizcode/InlineCodeTypedInsBuilderTest.kt → ...mpletion/InlineCodeTypedInsBuilderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters