Skip to content
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

LSP: Don't advertise support for Pull Diagnostics #627

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions lib/standard/lsp/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ def for(name)
@writer.write(id: request[:id], result: Proto::Interface::InitializeResult.new(
capabilities: Proto::Interface::ServerCapabilities.new(
document_formatting_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 All @@ -51,10 +47,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
18 changes: 1 addition & 17 deletions test/standard/runners/lsp_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ def test_server_initializes_and_responds_with_proper_capabilities
id: 2,
result: {capabilities: {
textDocumentSync: {openClose: true, change: 1},
documentFormattingProvider: true,
diagnosticProvider: {interFileDependencies: false, workspaceDiagnostics: false}
documentFormattingProvider: true
}},
jsonrpc: "2.0"
}
Expand Down Expand Up @@ -66,21 +65,6 @@ def test_did_open
}, msgs.first)
end

def test_diagnotic_route
msgs, err = run_server_on_requests({
method: "textDocument/diagnostic",
jsonrpc: "2.0",
params: {
textDocument: {
uri: "file:///path/to/file.rb"
}
}
})

assert_equal "", err.string
assert_equal 0, msgs.count
end
Comment on lines -69 to -82
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any intentions to remove rather than update the test case as follows?

  def test_diagnotic_route
    msgs, err = run_server_on_requests({
      method: "textDocument/diagnostic",
      jsonrpc: "2.0",
      params: {
        textDocument: {
          uri: "file:///path/to/file.rb"
        }
      }
    })

-   assert_equal ", err.string
-   assert_equal 0, msgs.count
+   assert_equal "[server] Unsupported Method: textDocument/diagnostic\n", err.string
+   assert_equal 1, msgs.count
  end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that spec makes sense like that. Since we don't advertise support for it, a client won't ever send us that message.


def test_format
msgs, err = run_server_on_requests(
{
Expand Down
Loading