Skip to content

Commit

Permalink
[Fix rubocop#12154] Fix incorrect diagnosticProvider value of LSP
Browse files Browse the repository at this point in the history
Fixes rubocop#12154.

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
  • Loading branch information
koic committed Aug 27, 2023
1 parent 4f46bc4 commit 2df1fd8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#12154](https://github.com/rubocop/rubocop/issues/12154): Fix incorrect `diagnosticProvider` value of LSP. ([@koic][])
5 changes: 4 additions & 1 deletion lib/rubocop/lsp/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def for(name)
result: LanguageServer::Protocol::Interface::InitializeResult.new(
capabilities: LanguageServer::Protocol::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: LanguageServer::Protocol::Interface::TextDocumentSyncOptions.new(
change: LanguageServer::Protocol::Constant::TextDocumentSyncKind::FULL,
open_close: true
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/lsp/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
capabilities: {
textDocumentSync: { openClose: true, change: 1 },
documentFormattingProvider: true,
diagnosticProvider: true
diagnosticProvider: { interFileDependencies: false, workspaceDiagnostics: false }
}
}
)
Expand Down

0 comments on commit 2df1fd8

Please sign in to comment.