Skip to content

Commit

Permalink
refactor(kotlin): update living documentation provider comment style
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 11, 2024
1 parent bcc0651 commit 25cb1c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ open class LivingDocPromptBuilder(
instruction.append("```${target.language.displayName}\n${target.text}\n```")

val startEndString = documentation.startEndString(type)
instruction.append(documentation.forbiddenRules.joinToString { "\n- $it" })
if (startEndString != null) {
instruction.append("\n\nStart your documentation with ${startEndString.first} here, and ends with `${startEndString.second}`.\n")
}

instruction.append("\n\nStart your documentation with ${startEndString.first} here, and ends with `${startEndString.second}`.\n")
instruction.append(documentation.forbiddenRules.joinToString { "\n- $it" })
instruction.toString()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface LivingDocumentation {
val parameterTagInstruction: String? get() = null
val returnTagInstruction: String? get() = null

fun startEndString(type: LivingDocumentationType): Pair<String, String>
fun startEndString(type: LivingDocumentationType): Pair<String, String>?

fun updateDoc(target: PsiElement, newDoc: String, type: LivingDocumentationType, editor: Editor)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class GoLivingDocumentationProvider : LivingDocumentation {
"Do not mention the containing package",
)

override fun startEndString(type: LivingDocumentationType): Pair<String, String> = "/*" to "*/"
override fun startEndString(type: LivingDocumentationType): Pair<String, String>? = null

override fun updateDoc(target: PsiElement, newDoc: String, type: LivingDocumentationType, editor: Editor) {
val project = runReadAction { target.project }
Expand Down

0 comments on commit 25cb1c1

Please sign in to comment.