From 07214dd8877af378ca7704724c9f77c94e86a052 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Wed, 30 Aug 2023 01:57:23 +0900 Subject: [PATCH] Fix incorrect `diagnosticProvider` value of LSP ## 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 https://github.com/rubocop/rubocop/issues/12154. --- lib/standard/lsp/routes.rb | 5 ++++- test/standard/runners/lsp_test.rb | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/standard/lsp/routes.rb b/lib/standard/lsp/routes.rb index d688e924..3afad197 100644 --- a/lib/standard/lsp/routes.rb +++ b/lib/standard/lsp/routes.rb @@ -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 diff --git a/test/standard/runners/lsp_test.rb b/test/standard/runners/lsp_test.rb index fc443915..4d013baf 100644 --- a/test/standard/runners/lsp_test.rb +++ b/test/standard/runners/lsp_test.rb @@ -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" }