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(
134
134
val out = StringBuilder ().append(" \n\n " ).append(" ----" ).append(" \n " )
135
135
kdoc.lineSequence().forEach { line ->
136
136
var start = 0
137
- while (start < line.length && Character .isWhitespace( line[start])) {
137
+ while (start < line.length && line[start].isWhitespace( )) {
138
138
start++
139
139
}
140
140
if (start < line.length && line[start] == ' /' ) {
@@ -143,14 +143,20 @@ class SemanticdbTextDocumentBuilder(
143
143
while (start < line.length && line[start] == ' *' ) {
144
144
start++
145
145
}
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--
148
149
}
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] == ' *' ) {
152
151
end--
153
152
}
153
+ while (end > start && line[end].isWhitespace()) {
154
+ end--
155
+ }
156
+ start = minOf(start, line.length - 1 )
157
+ if (end > start) {
158
+ end++
159
+ }
154
160
out .append(" \n " ).append(line, start, end)
155
161
}
156
162
return out .toString()
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ class AnalyzerTest {
105
105
documentation =
106
106
Documentation {
107
107
format = Semanticdb .Documentation .Format .MARKDOWN
108
- message = " ```kt\n class Banana\n ```"
108
+ message = " ```kt\n public final class Banana\n ```"
109
109
}
110
110
},
111
111
SymbolInformation {
@@ -115,7 +115,7 @@ class AnalyzerTest {
115
115
documentation =
116
116
Documentation {
117
117
format = Semanticdb .Documentation .Format .MARKDOWN
118
- message = " ```kt\n fun foo(): kotlin.Unit \n ```"
118
+ message = " ```kt\n public final fun foo()\n ```"
119
119
}
120
120
})
121
121
assertSoftly(document.symbolsList) { withClue(this ) { symbols.forEach(::shouldContain) } }
You can’t perform that action at this time.
0 commit comments