|
11 | 11 | //===----------------------------------------------------------------------===//
|
12 | 12 |
|
13 | 13 | #if canImport(SwiftDocC)
|
| 14 | +import Foundation |
14 | 15 | import LanguageServerProtocol
|
15 | 16 | import SKLogging
|
16 | 17 | import SKTestSupport
|
@@ -219,6 +220,53 @@ final class ConvertDocumentationTests: XCTestCase {
|
219 | 220 | )
|
220 | 221 | }
|
221 | 222 |
|
| 223 | + func testEditDocLineCommentAboveEnumCaseElement() async throws { |
| 224 | + let testClient = try await TestSourceKitLSPClient() |
| 225 | + let uri = DocumentURI(for: .swift) |
| 226 | + let positions = testClient.openDocument( |
| 227 | + """ |
| 228 | + /// An enumeration containing important information. |
| 229 | + public enum Enum { |
| 230 | + /// The first case. |
| 231 | + case first |
| 232 | +
|
| 233 | + /// The 0️⃣second case. |
| 234 | + case second |
| 235 | +
|
| 236 | + // The third case. |
| 237 | + case third(Int) |
| 238 | + } |
| 239 | + """, |
| 240 | + uri: uri |
| 241 | + ) |
| 242 | + |
| 243 | + // Make sure that the initial documentation comment is present in the response |
| 244 | + await convertDocumentation( |
| 245 | + testClient: testClient, |
| 246 | + uri: uri, |
| 247 | + positions: positions, |
| 248 | + expectedResponses: [.renderNode(kind: .symbol, containing: "The second case")] |
| 249 | + ) |
| 250 | + |
| 251 | + // Change the content of the documentation comment |
| 252 | + testClient.send( |
| 253 | + DidChangeTextDocumentNotification( |
| 254 | + textDocument: VersionedTextDocumentIdentifier(uri, version: 2), |
| 255 | + contentChanges: [ |
| 256 | + TextDocumentContentChangeEvent(range: positions["0️⃣"]..<positions["0️⃣"], text: "very ") |
| 257 | + ] |
| 258 | + ) |
| 259 | + ) |
| 260 | + |
| 261 | + // Make sure that the new documentation comment is present in the response |
| 262 | + await convertDocumentation( |
| 263 | + testClient: testClient, |
| 264 | + uri: uri, |
| 265 | + positions: positions, |
| 266 | + expectedResponses: [.renderNode(kind: .symbol, containing: "The very second case")] |
| 267 | + ) |
| 268 | + } |
| 269 | + |
222 | 270 | func testProtocol() async throws {
|
223 | 271 | try await convertDocumentation(
|
224 | 272 | swiftFile: """
|
|
0 commit comments