Skip to content

Commit 5f34372

Browse files
committed
fix(knowledge): format code snippet output with newline
fix(container): add file validation check for Dockerfile - Fix code snippet formatting in `KnowledgeFunctionProvider` to include a newline after the colon. - Add file validation check in `RunDockerfileService` to ensure the file is valid before checking its language
1 parent 519b9e3 commit 5f34372

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

core/src/main/kotlin/cc/unitmesh/devti/bridge/knowledge/KnowledgeFunctionProvider.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class KnowledgeFunctionProvider : ToolchainFunctionProvider {
9595
}
9696

9797
val lang = psiElements.firstOrNull()?.language?.displayName ?: ""
98-
return "Here is $prop related code: ```$lang\n$elementText\n```"
98+
return "Here is $prop related code:\n```$lang\n$elementText\n```"
9999
}
100100

101101
fun commentSymbol(element: PsiElement): String {

exts/ext-container/src/233/main/kotlin/cc/unitmesh/container/RunDockerfileService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import kotlinx.coroutines.runBlocking
1818

1919
class RunDockerfileService : RunService {
2020
override fun isApplicable(project: Project, file: VirtualFile): Boolean = file.name == "Dockerfile" ||
21-
runReadAction { PsiManager.getInstance(project).findFile(file)?.language == DockerLanguage.INSTANCE }
21+
file.isValid && runReadAction { PsiManager.getInstance(project).findFile(file)?.language == DockerLanguage.INSTANCE }
2222

2323
override fun runConfigurationClass(project: Project): Class<out RunProfile>? = null
2424

0 commit comments

Comments
 (0)