-
Notifications
You must be signed in to change notification settings - Fork 307
Add boilerplate for pull-model diagnostics #743
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
Add boilerplate for pull-model diagnostics #743
Conversation
@ahoppen You mentioned that support for pull diagnostic requests already exists in sourcekit. Any pointers on how to get to that data from the dummy |
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. I really wonder how I missed all of this when updating the definitions to LSP 3.17 🤔
dict["workspaceDiagnostics"] = .bool(diagnosticOptions.workspaceDiagnostics) | ||
if let workDoneProgress = diagnosticOptions.workDoneProgress { | ||
dict["workDoneProgress"] = .bool(workDoneProgress) | ||
} |
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.
I think you also need to encode documentSelector
(from TextDocumentRegistrationOptions
in the LSP spec) and id
(from StaticRegistrationOptions
in the LSP spec) here.
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.
Oops, I couldn't get to this before the PR got merged. I will address it in my next PR when implementing the feature.
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.
documentSelector
is already added to the dict by textDocumentRegistrationOptions.encodeIntoLSPAny(dict: &dict)
at least.
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.
Whoops, and I apparently approved and merged the PR, forgotting that I still had a comment. If you could create a follow-up PR, that would be great.
@swift-ci Please test |
The main entry point where the diagnostic request is being handled in https://github.com/apple/swift/blob/main/test/SourceKit/Diagnostics/diags.swift has some examples of how the diagnostics request can be invoked using
And an example of how to send a request to I hope this gives you enough pointers to get started. Let me know if you need more help. |
Adds the capabilities, options and registration structs for pull-model diagnostics. I kept
SwiftLanguageServer.initializeSync
not reporting support for pull request diagnostics yet, so change currently has no impact.Related to #500
How tested
SwiftLanguageServer.initializeSync
, then built, ran locally in VS Code and confirmed that I could get a dummy diagnostic shown in VS Code.publishDiagnostics
still work.(
sourcekit-lsp
tests currently don't build on Windows and I don't have a mac machine handy)