-
Notifications
You must be signed in to change notification settings - Fork 314
Add notification to inform SourceKit-LSP about the currently active document #1989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@swift-ci Please test |
@@ -725,15 +727,16 @@ extension SourceKitLSPServer: QueueBasedMessageHandler { | |||
|
|||
logger.log("Received request \(id): \(params.forLogging)") | |||
|
|||
if let textDocumentRequest = params as? any TextDocumentRequest { | |||
if self.capabilityRegistry?.clientHasExperimentalCapability(DidChangeActiveDocumentNotification.method) ?? false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be the reverse (ie. only infer the active document if the client doesn't support this notification)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, whoops. That’s also why the tests are failing 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo Ben's comment
3875111
to
2a2e1fe
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
…ocument SourceKit-LSP prepares the currently active file for editor functionality and currently infers the currently active document from whichever received the last `TextDocumentRequest`. If an editor is capable of doing so, it should be able to report the document that the user currently has focused so that SourceKit-LSP does not have to infer this information from other requests. Also clean up some handling code for experimental capabilities.
2a2e1fe
to
4d00c90
Compare
@swift-ci Please test |
@swift-ci Please test Windows |
1 similar comment
@swift-ci Please test Windows |
`sourcekit-lsp` recently added an LSP extension method to notify the server of the active documnent, so it doesn't need to infer it from information in other requests. This capability was added in swiftlang/sourcekit-lsp#1989.
`sourcekit-lsp` recently added an LSP extension method to notify the server of the active documnent, so it doesn't need to infer it from information in other requests. This capability was added in swiftlang/sourcekit-lsp#1989.
`sourcekit-lsp` recently added an LSP extension method to notify the server of the active documnent, so it doesn't need to infer it from information in other requests. This capability was added in swiftlang/sourcekit-lsp#1989. Co-authored-by: Alex Hoppen <[email protected]>
SourceKit-LSP prepares the currently active file for editor functionality and currently infers the currently active document from whichever received the last
TextDocumentRequest
.If an editor is capable of doing so, it should be able to report the document that the user currently has focused so that SourceKit-LSP does not have to infer this information from other requests.
Also clean up some handling code for experimental capabilities.