Skip to content

Commit 591e5ae

Browse files
authored
Merge pull request #1132 from ahoppen/ahoppen/renames
A couple of renames for clarity
2 parents 83837ce + bd1ff8a commit 591e5ae

File tree

58 files changed

+741
-718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+741
-718
lines changed

Sources/SKSwiftPMWorkspace/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
add_library(SKSwiftPMWorkspace STATIC
3-
SwiftPMWorkspace.swift)
3+
SwiftPMBuildSystem.swift)
44
set_target_properties(SKSwiftPMWorkspace PROPERTIES
55
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
66
target_link_libraries(SKSwiftPMWorkspace PRIVATE

Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift renamed to Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ private func getDefaultToolchain(_ toolchainRegistry: ToolchainRegistry) async -
6363
/// This class implements the `BuildSystem` interface to provide the build settings for a Swift
6464
/// Package Manager (SwiftPM) package. The settings are determined by loading the Package.swift
6565
/// manifest using `libSwiftPM` and constructing a build plan using the default (debug) parameters.
66-
public actor SwiftPMWorkspace {
66+
public actor SwiftPMBuildSystem {
6767

6868
public enum Error: Swift.Error {
6969

@@ -197,7 +197,7 @@ public actor SwiftPMWorkspace {
197197
}
198198
}
199199

200-
extension SwiftPMWorkspace {
200+
extension SwiftPMBuildSystem {
201201

202202
/// (Re-)load the package settings by parsing the manifest and resolving all the targets and
203203
/// dependencies.
@@ -270,7 +270,7 @@ extension SwiftPMWorkspace {
270270
}
271271
}
272272

273-
extension SwiftPMWorkspace: SKCore.BuildSystem {
273+
extension SwiftPMBuildSystem: SKCore.BuildSystem {
274274

275275
public var buildPath: TSCAbsolutePath {
276276
return TSCAbsolutePath(buildParameters.buildPath)
@@ -382,7 +382,7 @@ extension SwiftPMWorkspace: SKCore.BuildSystem {
382382
}
383383
}
384384

385-
extension SwiftPMWorkspace {
385+
extension SwiftPMBuildSystem {
386386

387387
// MARK: Implementation details
388388

Sources/SKTestSupport/IndexedSingleSwiftFileWorkspace.swift renamed to Sources/SKTestSupport/IndexedSingleSwiftFileTestProject.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import LanguageServerProtocol
1717
import SourceKitLSP
1818
import TSCBasic
1919

20-
public struct IndexedSingleSwiftFileWorkspace {
20+
public struct IndexedSingleSwiftFileTestProject {
2121
enum Error: Swift.Error {
2222
case swiftcNotFound
2323
}
@@ -95,7 +95,7 @@ public struct IndexedSingleSwiftFileWorkspace {
9595
}
9696

9797
// Create the test client
98-
var options = SourceKitServer.Options.testDefault
98+
var options = SourceKitLSPServer.Options.testDefault
9999
options.indexOptions = IndexOptions(
100100
indexStorePath: try AbsolutePath(validating: indexURL.path),
101101
indexDatabasePath: try AbsolutePath(validating: indexDBURL.path)

Sources/SKTestSupport/MultiFileTestWorkspace.swift renamed to Sources/SKTestSupport/MultiFileTestProject.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ public struct RelativeFileLocation: Hashable, ExpressibleByStringLiteral {
3333
}
3434
}
3535

36-
/// A workspace that writes multiple files to disk and opens a `TestSourceKitLSPClient` client with a workspace pointing
37-
/// to a temporary directory containing those files.
36+
/// A test project that writes multiple files to disk and opens a `TestSourceKitLSPClient` client with a workspace
37+
/// pointing to a temporary directory containing those files.
3838
///
3939
/// The temporary files will be deleted when the `TestSourceKitLSPClient` is destructed.
40-
public class MultiFileTestWorkspace {
40+
public class MultiFileTestProject {
4141
/// Information necessary to open a file in the LSP server by its filename.
4242
private struct FileData {
4343
/// The URI at which the file is stored on disk.
@@ -53,7 +53,7 @@ public class MultiFileTestWorkspace {
5353
private let fileData: [String: FileData]
5454

5555
enum Error: Swift.Error {
56-
/// No file with the given filename is known to the `SwiftPMTestWorkspace`.
56+
/// No file with the given filename is known to the `MultiFileTestProject`.
5757
case fileNotFound
5858
}
5959

Sources/SKTestSupport/SkipUnless.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public enum SkipUnless {
180180
line: UInt = #line
181181
) async throws {
182182
try await skipUnlessSupportedByToolchain(swiftVersion: SwiftVersion(5, 11), file: file, line: line) {
183-
let workspace = try await SwiftPMTestWorkspace(
183+
let workspace = try await SwiftPMTestProject(
184184
files: ["test.swift": ""],
185185
build: true
186186
)

Sources/SKTestSupport/SwiftPMTestWorkspace.swift renamed to Sources/SKTestSupport/SwiftPMTestProject.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import LanguageServerProtocol
1515
@_spi(Testing) import SKCore
1616
import TSCBasic
1717

18-
public class SwiftPMTestWorkspace: MultiFileTestWorkspace {
18+
public class SwiftPMTestProject: MultiFileTestProject {
1919
enum Error: Swift.Error {
2020
/// The `swift` executable could not be found.
2121
case swiftNotFound
@@ -37,7 +37,7 @@ public class SwiftPMTestWorkspace: MultiFileTestWorkspace {
3737
/// If `index` is `true`, then the package will be built, indexing all modules within the package.
3838
public init(
3939
files: [RelativeFileLocation: String],
40-
manifest: String = SwiftPMTestWorkspace.defaultPackageManifest,
40+
manifest: String = SwiftPMTestProject.defaultPackageManifest,
4141
workspaces: (URL) -> [WorkspaceFolder] = { [WorkspaceFolder(uri: DocumentURI($0))] },
4242
build: Bool = false,
4343
usePullDiagnostics: Bool = true,

Sources/SKTestSupport/TestSourceKitLSPClient.swift

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import SourceKitLSP
2020
import SwiftSyntax
2121
import XCTest
2222

23-
extension SourceKitServer.Options {
24-
/// The default SourceKitServer options for testing.
23+
extension SourceKitLSPServer.Options {
24+
/// The default SourceKitLSPServer options for testing.
2525
public static var testDefault = Self(swiftPublishDiagnosticsDebounceDuration: 0)
2626
}
2727

@@ -44,7 +44,7 @@ public final class TestSourceKitLSPClient: MessageHandler {
4444
private let moduleCache: URL?
4545

4646
/// The server that handles the requests.
47-
public let server: SourceKitServer
47+
public let server: SourceKitLSPServer
4848

4949
/// Whether pull or push-model diagnostics should be used.
5050
///
@@ -70,7 +70,7 @@ public final class TestSourceKitLSPClient: MessageHandler {
7070

7171
/// A closure that is called when the `TestSourceKitLSPClient` is destructed.
7272
///
73-
/// This allows e.g. a `IndexedSingleSwiftFileWorkspace` to delete its temporary files when they are no longer needed.
73+
/// This allows e.g. a `IndexedSingleSwiftFileTestProject` to delete its temporary files when they are no longer needed.
7474
private let cleanUp: () -> Void
7575

7676
/// - Parameters:
@@ -84,10 +84,10 @@ public final class TestSourceKitLSPClient: MessageHandler {
8484
/// - usePullDiagnostics: Whether to use push diagnostics or use push-based diagnostics
8585
/// - workspaceFolders: Workspace folders to open.
8686
/// - cleanUp: A closure that is called when the `TestSourceKitLSPClient` is destructed.
87-
/// This allows e.g. a `IndexedSingleSwiftFileWorkspace` to delete its temporary files when they are no longer
87+
/// This allows e.g. a `IndexedSingleSwiftFileTestProject` to delete its temporary files when they are no longer
8888
/// needed.
8989
public init(
90-
serverOptions: SourceKitServer.Options = .testDefault,
90+
serverOptions: SourceKitLSPServer.Options = .testDefault,
9191
useGlobalModuleCache: Bool = true,
9292
initialize: Bool = true,
9393
initializationOptions: LSPAny? = nil,
@@ -114,7 +114,7 @@ public final class TestSourceKitLSPClient: MessageHandler {
114114

115115
let serverToClientConnection = LocalConnection()
116116
self.serverToClientConnection = serverToClientConnection
117-
server = SourceKitServer(
117+
server = SourceKitLSPServer(
118118
client: serverToClientConnection,
119119
toolchainRegistry: ToolchainRegistry.forTesting,
120120
options: serverOptions,
@@ -262,26 +262,25 @@ public final class TestSourceKitLSPClient: MessageHandler {
262262

263263
/// Handle the next request that is sent to the client with the given handler.
264264
///
265-
/// By default, `TestSourceKitServer` emits an `XCTFail` if a request is sent
265+
/// By default, `TestSourceKitLSPClient` emits an `XCTFail` if a request is sent
266266
/// to the client, since it doesn't know how to handle it. This allows the
267267
/// simulation of a single request's handling on the client.
268268
///
269269
/// If the next request that is sent to the client is of a different kind than
270-
/// the given handler, `TestSourceKitServer` will emit an `XCTFail`.
270+
/// the given handler, `TestSourceKitLSPClient` will emit an `XCTFail`.
271271
public func handleNextRequest<R: RequestType>(_ requestHandler: @escaping RequestHandler<R>) {
272272
requestHandlers.append(requestHandler)
273273
}
274274

275275
// MARK: - Conformance to MessageHandler
276276

277-
/// - Important: Implementation detail of `TestSourceKitServer`. Do not call
277+
/// - Important: Implementation detail of `TestSourceKitLSPServer`. Do not call
278278
/// from tests.
279279
public func handle(_ params: some NotificationType) {
280280
notificationYielder.yield(params)
281281
}
282282

283-
/// - Important: Implementation detail of `TestSourceKitServer`. Do not call
284-
/// from tests.
283+
/// - Important: Implementation detail of `TestSourceKitLSPClient`. Do not call from tests.
285284
public func handle<Request: RequestType>(
286285
_ params: Request,
287286
id: LanguageServerProtocol.RequestID,
@@ -393,8 +392,8 @@ public struct DocumentPositions {
393392

394393
/// Wrapper around a weak `MessageHandler`.
395394
///
396-
/// This allows us to set the ``TestSourceKitServer`` as the message handler of
397-
/// `SourceKitServer` without retaining it.
395+
/// This allows us to set the ``TestSourceKitLSPClient`` as the message handler of
396+
/// `SourceKitLSPServer` without retaining it.
398397
private class WeakMessageHandler: MessageHandler {
399398
private weak var handler: (any MessageHandler)?
400399

Sources/SourceKitLSP/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ add_library(SourceKitLSP STATIC
33
CapabilityRegistry.swift
44
DocumentManager.swift
55
IndexStoreDB+MainFilesProvider.swift
6-
ResponseError+Init.swift
6+
LanguageService.swift
77
Rename.swift
8+
ResponseError+Init.swift
89
Sequence+AsyncMap.swift
910
SourceKitIndexDelegate.swift
1011
SourceKitLSPCommandMetadata.swift
11-
SourceKitServer.swift
12-
SourceKitServer+Options.swift
12+
SourceKitLSPServer.swift
13+
SourceKitLSPServer+Options.swift
1314
TestDiscovery.swift
14-
ToolchainLanguageServer.swift
1515
WorkDoneProgressManager.swift
1616
Workspace.swift
1717
)
1818
target_sources(SourceKitLSP PRIVATE
19-
Clang/ClangLanguageServer.swift)
19+
Clang/ClangLanguageService.swift)
2020
target_sources(SourceKitLSP PRIVATE
2121
Swift/AdjustPositionToStartOfIdentifier.swift
2222
Swift/CodeCompletion.swift
@@ -36,7 +36,7 @@ target_sources(SourceKitLSP PRIVATE
3636
Swift/SemanticTokens.swift
3737
Swift/SourceKitD+ResponseError.swift
3838
Swift/SwiftCommand.swift
39-
Swift/SwiftLanguageServer.swift
39+
Swift/SwiftLanguageService.swift
4040
Swift/SymbolInfo.swift
4141
Swift/SyntaxHighlightingToken.swift
4242
Swift/SyntaxHighlightingTokenParser.swift

Sources/SourceKitLSP/CapabilityRegistry.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public final actor CapabilityRegistry {
135135
options: Options,
136136
forMethod method: String,
137137
languages: [Language],
138-
in server: SourceKitServer,
138+
in server: SourceKitLSPServer,
139139
registrationDict: [CapabilityRegistration: Options],
140140
setRegistrationDict: (CapabilityRegistration, Options?) -> Void
141141
) async {
@@ -176,7 +176,7 @@ public final actor CapabilityRegistry {
176176
public func registerCompletionIfNeeded(
177177
options: CompletionOptions,
178178
for languages: [Language],
179-
server: SourceKitServer
179+
server: SourceKitLSPServer
180180
) async {
181181
guard clientHasDynamicCompletionRegistration else { return }
182182

@@ -195,7 +195,7 @@ public final actor CapabilityRegistry {
195195

196196
public func registerDidChangeWatchedFiles(
197197
watchers: [FileSystemWatcher],
198-
server: SourceKitServer
198+
server: SourceKitLSPServer
199199
) async {
200200
guard clientHasDynamicDidChangeWatchedFilesRegistration else { return }
201201
if let registration = didChangeWatchedFiles {
@@ -230,7 +230,7 @@ public final actor CapabilityRegistry {
230230
public func registerFoldingRangeIfNeeded(
231231
options: FoldingRangeOptions,
232232
for languages: [Language],
233-
server: SourceKitServer
233+
server: SourceKitLSPServer
234234
) async {
235235
guard clientHasDynamicFoldingRangeRegistration else { return }
236236

@@ -253,7 +253,7 @@ public final actor CapabilityRegistry {
253253
public func registerSemanticTokensIfNeeded(
254254
options: SemanticTokensOptions,
255255
for languages: [Language],
256-
server: SourceKitServer
256+
server: SourceKitLSPServer
257257
) async {
258258
guard clientHasDynamicSemanticTokensRegistration else { return }
259259

@@ -276,7 +276,7 @@ public final actor CapabilityRegistry {
276276
public func registerInlayHintIfNeeded(
277277
options: InlayHintOptions,
278278
for languages: [Language],
279-
server: SourceKitServer
279+
server: SourceKitLSPServer
280280
) async {
281281
guard clientHasDynamicInlayHintRegistration else { return }
282282
await registerLanguageSpecificCapability(
@@ -297,7 +297,7 @@ public final actor CapabilityRegistry {
297297
public func registerDiagnosticIfNeeded(
298298
options: DiagnosticOptions,
299299
for languages: [Language],
300-
server: SourceKitServer
300+
server: SourceKitLSPServer
301301
) async {
302302
guard clientHasDynamicDocumentDiagnosticsRegistration else { return }
303303

@@ -318,7 +318,7 @@ public final actor CapabilityRegistry {
318318
/// it and we haven't yet registered the given command IDs yet.
319319
public func registerExecuteCommandIfNeeded(
320320
commands: [String],
321-
server: SourceKitServer
321+
server: SourceKitLSPServer
322322
) {
323323
guard clientHasDynamicExecuteCommandRegistration else { return }
324324

0 commit comments

Comments
 (0)