File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
main/kotlin/com/sourcegraph/semanticdb_kotlinc
test/kotlin/com/sourcegraph/semanticdb_kotlinc/test Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ class SemanticdbTextDocumentBuilder(
134134 val out = StringBuilder ().append(" \n\n " ).append(" ----" ).append(" \n " )
135135 kdoc.lineSequence().forEach { line ->
136136 var start = 0
137- while (start < line.length && Character .isWhitespace( line[start])) {
137+ while (start < line.length && line[start].isWhitespace( )) {
138138 start++
139139 }
140140 if (start < line.length && line[start] == ' /' ) {
@@ -143,14 +143,20 @@ class SemanticdbTextDocumentBuilder(
143143 while (start < line.length && line[start] == ' *' ) {
144144 start++
145145 }
146- while (start < line.length && Character .isWhitespace(line[start])) {
147- start++
146+ var end = line.length - 1
147+ if (end > start && line[end] == ' /' ) {
148+ end--
148149 }
149- var end = if (line.endsWith(" */" )) line.length - 3 else line.length - 1
150- end = maxOf(start, end)
151- while (end > start && Character .isWhitespace(line[end])) {
150+ while (end > start && line[end] == ' *' ) {
152151 end--
153152 }
153+ while (end > start && line[end].isWhitespace()) {
154+ end--
155+ }
156+ start = minOf(start, line.length - 1 )
157+ if (end > start) {
158+ end++
159+ }
154160 out .append(" \n " ).append(line, start, end)
155161 }
156162 return out .toString()
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ class AnalyzerTest {
105105 documentation =
106106 Documentation {
107107 format = Semanticdb .Documentation .Format .MARKDOWN
108- message = " ```kt\n class Banana\n ```"
108+ message = " ```kt\n public final class Banana\n ```"
109109 }
110110 },
111111 SymbolInformation {
@@ -115,7 +115,7 @@ class AnalyzerTest {
115115 documentation =
116116 Documentation {
117117 format = Semanticdb .Documentation .Format .MARKDOWN
118- message = " ```kt\n fun foo(): kotlin.Unit \n ```"
118+ message = " ```kt\n public final fun foo()\n ```"
119119 }
120120 })
121121 assertSoftly(document.symbolsList) { withClue(this ) { symbols.forEach(::shouldContain) } }
You can’t perform that action at this time.
0 commit comments