-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comment): make kotlin comment support works #1
- Loading branch information
Showing
8 changed files
with
112 additions
and
55 deletions.
There are no files selected for viewing
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
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
14 changes: 12 additions & 2 deletions
14
unit-picker/src/main/kotlin/cc/unitmesh/pick/strategy/bizcode/CommentsStrategyBuilder.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 |
---|---|---|
@@ -1,17 +1,27 @@ | ||
package cc.unitmesh.pick.strategy.bizcode | ||
|
||
import cc.unitmesh.core.SupportedLang | ||
import cc.unitmesh.core.completion.TypedIns | ||
import cc.unitmesh.pick.builder.comment.KotlinCommentBuilder | ||
import cc.unitmesh.pick.strategy.base.CodeStrategyBuilder | ||
import cc.unitmesh.pick.worker.job.JobContext | ||
|
||
/** | ||
* 对于其它不需要上下文的 AI 能力,需要实现一个空的上下文策略,如注释生成。 | ||
*/ | ||
class CommentsStrategyBuilder(val context: JobContext) : CodeStrategyBuilder { | ||
private val kotlinCommentBuilder = KotlinCommentBuilder() | ||
|
||
override fun build(): List<TypedIns> { | ||
val language = context.job.fileSummary.language.lowercase() | ||
val container = context.job.container ?: return emptyList() | ||
|
||
return emptyList() | ||
val language = context.project.language | ||
return when (language) { | ||
SupportedLang.JAVA -> kotlinCommentBuilder.build(context.job.code, container) | ||
SupportedLang.TYPESCRIPT -> TODO() | ||
SupportedLang.KOTLIN -> { | ||
kotlinCommentBuilder.build(context.job.code, container) | ||
} | ||
} | ||
} | ||
} |
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