swiftlang / vscode-swift

Visual Studio Code Extension for Swift
https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang
Apache License 2.0
708 stars 47 forks source link

Write log messages from SourceKit-LSP’s index log to a separate output view #833

Closed ahoppen closed 2 weeks ago

ahoppen commented 1 month ago

https://github.com/apple/sourcekit-lsp/pull/1398 adds an LSP extension to set a logName in the window/logMessage notifications. It would be great if the VS Code extension could write log messages that have logName set to an output view with that name. This would ensure that the index log does not get interleaved with other logs from SourceKit-LSP such as stderr messages or the message trace if verbose logging is enabled in the Swift extension.

adam-fowler commented 4 weeks ago

The logging of LSP output is internal to the VSCode language client. We don't have control over this. I checked to see if we could catch log messages via a middleware but that doesn't seem possible either.

ahoppen commented 4 weeks ago

I think @award999 had some ideas of how to capture the log output.

award999 commented 4 weeks ago

Ya we can't hook into the middleware but should be able to set an notification handler, I'll take a look next week and make sure works as I expect it to

award999 commented 2 weeks ago

For verification need to enable background indexing https://github.com/apple/sourcekit-lsp/blob/main/Documentation/Enable%20Experimental%20Background%20Indexing.md

matthewbastien commented 2 weeks ago

Verified with e8308d6