Skip to content

Commit aae7668

Browse files
committed
Implement test discovery for swift-testing tests for the textDocument/tests request
This allows us to return swift-testing tests within a single document. It does not look for swift-testing tests workspace-wide (the `workspace/tests` request), which will be a follow-up PR.
1 parent 604e9b9 commit aae7668

File tree

5 files changed

+1045
-9
lines changed

5 files changed

+1045
-9
lines changed

Sources/LanguageServerProtocol/SupportTypes/TestItem.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ public struct TestItem: ResponseType, Equatable {
3838
/// When `nil` the `label` is used.
3939
public let sortText: String?
4040

41+
/// Whether the test is disabled.
42+
public let disabled: Bool
43+
44+
/// The type of test, eg. the testing framework that was used to declare the test.
45+
public let style: String
46+
4147
/// The location of the test item in the source code.
4248
public let location: Location
4349

@@ -47,11 +53,16 @@ public struct TestItem: ResponseType, Equatable {
4753
/// Tags associated with this test item.
4854
public let tags: [TestTag]
4955

56+
public static let testStyleXCTest = "XCTest"
57+
public static let testStyleSwiftTesting = "swift-testing"
58+
5059
public init(
5160
id: String,
5261
label: String,
5362
description: String? = nil,
5463
sortText: String? = nil,
64+
disabled: Bool,
65+
style: String,
5566
location: Location,
5667
children: [TestItem],
5768
tags: [TestTag]
@@ -60,6 +71,8 @@ public struct TestItem: ResponseType, Equatable {
6071
self.label = label
6172
self.description = description
6273
self.sortText = sortText
74+
self.disabled = disabled
75+
self.style = style
6376
self.location = location
6477
self.children = children
6578
self.tags = tags

Sources/SourceKitLSP/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ target_sources(SourceKitLSP PRIVATE
3838
Swift/SourceKitD+ResponseError.swift
3939
Swift/SwiftCommand.swift
4040
Swift/SwiftLanguageService.swift
41+
Swift/SwiftTestingScanner.swift
4142
Swift/SymbolInfo.swift
4243
Swift/SyntaxHighlightingToken.swift
4344
Swift/SyntaxHighlightingTokenParser.swift

0 commit comments

Comments
 (0)