Skip to content

Commit c44ee45

Browse files
committed
Add an extension to the LogMessageNotification to add a message to a specific log in the client
If the editor has support for this LSP extension, it can create a separate output view for the index log. For example, in VS Code, we could have one output view for the standard LSP logging (which are the messages between VS Code and SourceKit-LSP if verbose logging is enabled in VS Code) and a separate log that shows information about background indexing. rdar://128572032
1 parent 98718d4 commit c44ee45

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Sources/LanguageServerProtocol/Notifications/LogMessageNotification.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ public struct LogMessageNotification: NotificationType, Hashable {
2424
/// The contents of the message.
2525
public var message: String
2626

27-
public init(type: WindowMessageType, message: String) {
27+
/// If specified, the client should log the message to a log with this name instead of the standard log for this LSP
28+
/// server.
29+
///
30+
/// **(LSP Extension)**
31+
public var logName: String?
32+
33+
public init(type: WindowMessageType, message: String, logName: String?) {
2834
self.type = type
2935
self.message = message
36+
self.logName = logName
3037
}
3138
}

Sources/SourceKitLSP/SourceKitLSPServer.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,8 @@ extension SourceKitLSPServer {
845845
\(result.taskDescription) finished in \(result.duration)
846846
\(result.command)
847847
\(result.output)
848-
"""
848+
""",
849+
logName: "SourceKit-LSP: Indexing"
849850
)
850851
)
851852
}

0 commit comments

Comments
 (0)