Skip to content

Commit

Permalink
Fix incorrect diagnosticProvider value of LSP
Browse files Browse the repository at this point in the history
## Summary

This PR fixes incorrect `diagnosticProvider` value of LSP.

`diagnosticProvider` cannot accept `true` as below. This PR replaces the originally acceptable value.

```typescript
/**
 * The server has support for pull model diagnostics.
 *
 * @SInCE 3.17.0
 */
diagnosticProvider?: DiagnosticOptions | DiagnosticRegistrationOptions;
```

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#initialize

## Additional Information

This issue was found in rubocop/rubocop#12154.
  • Loading branch information
koic committed Aug 30, 2023
1 parent d7868a2 commit 07214dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/standard/lsp/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def for(name)
@writer.write(id: request[:id], result: Proto::Interface::InitializeResult.new(
capabilities: Proto::Interface::ServerCapabilities.new(
document_formatting_provider: true,
diagnostic_provider: true,
diagnostic_provider: LanguageServer::Protocol::Interface::DiagnosticOptions.new(
inter_file_dependencies: false,
workspace_diagnostics: false
),
text_document_sync: Proto::Interface::TextDocumentSyncOptions.new(
change: Proto::Constant::TextDocumentSyncKind::FULL,
open_close: true
Expand Down
2 changes: 1 addition & 1 deletion test/standard/runners/lsp_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_server_initializes_and_responds_with_proper_capabilities
result: {capabilities: {
textDocumentSync: {openClose: true, change: 1},
documentFormattingProvider: true,
diagnosticProvider: true
diagnosticProvider: {interFileDependencies: false, workspaceDiagnostics: false}
}},
jsonrpc: "2.0"
}
Expand Down

0 comments on commit 07214dd

Please sign in to comment.