Skip to content

Commit 2fd8438

Browse files
committed
[BSP] Make MessageRegistry.bspProtocol a static stored property
This should be an immutable value and `MessageRegistry.init()` is not a trivial constructor. No reason to keep it a computed property. Also, Move `MessageRegistry.lspProtocol` to LanguageServerProtocol/Messages.swift to align with the BSP couterpart.
1 parent f86b413 commit 2fd8438

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Sources/BuildServerProtocol/Messages.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ private let notificationTypes: [NotificationType.Type] = [
4141
]
4242

4343
extension MessageRegistry {
44-
public static var bspProtocol: MessageRegistry {
44+
public static let bspProtocol: MessageRegistry =
4545
MessageRegistry(requests: requestTypes, notifications: notificationTypes)
46-
}
4746
}
4847

4948
@available(*, deprecated, message: "use MessageRegistry.bspProtocol instead")
50-
public let bspRegistry = MessageRegistry(requests: requestTypes, notifications: notificationTypes)
49+
public let bspRegistry = MessageRegistry.bspProtocol

Sources/LanguageServerProtocol/MessageRegistry.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
public final class MessageRegistry: Sendable {
14-
15-
public static let lspProtocol: MessageRegistry =
16-
MessageRegistry(requests: builtinRequests, notifications: builtinNotifications)
17-
1814
private let methodToRequest: [String: _RequestType.Type]
1915
private let methodToNotification: [String: NotificationType.Type]
2016

Sources/LanguageServerProtocol/Messages.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ public let builtinNotifications: [NotificationType.Type] = [
128128
WorkDoneProgress.self,
129129
]
130130

131+
extension MessageRegistry {
132+
public static let lspProtocol: MessageRegistry =
133+
MessageRegistry(requests: builtinRequests, notifications: builtinNotifications)
134+
}
135+
131136
// MARK: Miscellaneous Message Types
132137

133138
public struct VoidResponse: ResponseType, Hashable {

0 commit comments

Comments
 (0)