Skip to content

Commit

Permalink
LSP: Don't advertise support for Pull Diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
koic authored and bbatsov committed May 16, 2024
1 parent 065fb23 commit 47ee67c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
8 changes: 0 additions & 8 deletions lib/rubocop/lsp/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ def for(name)
result: LanguageServer::Protocol::Interface::InitializeResult.new(
capabilities: LanguageServer::Protocol::Interface::ServerCapabilities.new(
document_formatting_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 All @@ -73,10 +69,6 @@ def for(name)
end
end

handle 'textDocument/diagnostic' do |request|
# no-op, diagnostics are handled in textDocument/didChange
end

handle 'textDocument/didChange' do |request|
params = request[:params]
result = diagnostic(params[:textDocument][:uri], params[:contentChanges][0][:text])
Expand Down
22 changes: 1 addition & 21 deletions spec/rubocop/lsp/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
result: {
capabilities: {
textDocumentSync: { openClose: true, change: 1 },
documentFormattingProvider: true,
diagnosticProvider: { interFileDependencies: false, workspaceDiagnostics: false }
documentFormattingProvider: true
}
}
)
Expand Down Expand Up @@ -96,25 +95,6 @@
end
end

describe 'diagnotic route' do
let(:requests) do
[
jsonrpc: '2.0',
method: 'textDocument/diagnostic',
params: {
textDocument: {
uri: 'file:///path/to/file.rb'
}
}
]
end

it 'handles requests' do
expect(stderr).to eq('')
expect(messages.count).to eq(0)
end
end

describe 'format by default (safe autocorrect)' do
let(:requests) do
[
Expand Down

0 comments on commit 47ee67c

Please sign in to comment.