Skip to content

Commit

Permalink
Merge pull request #601 from muxcmux/main
Browse files Browse the repository at this point in the history
Remove incorrect textDocument/diagnostic request handler
  • Loading branch information
searls authored Apr 24, 2024
2 parents 3f86557 + af486c1 commit 9917773
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 33 deletions.
6 changes: 2 additions & 4 deletions lib/standard/lsp/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@ def for(name)
end
end

handle "textDocument/diagnostic" do |request|
doc = request[:params][:textDocument]
result = diagnostic(doc[:uri], doc[:text])
@writer.write(result)
handle "textDocument/diagnostic" do |_request|
# no op, diagnostics are handled in textDocument/didChange
end

handle "textDocument/didChange" do |request|
Expand Down
31 changes: 2 additions & 29 deletions test/standard/runners/lsp_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,40 +72,13 @@ def test_diagnotic_route
jsonrpc: "2.0",
params: {
textDocument: {
languageId: "ruby",
text: "def hi\n [1, 2,\n 3 ]\nend\n",
uri: "file:///path/to/file.rb",
version: 0
uri: "file:///path/to/file.rb"
}
}
})

assert_equal "", err.string
assert_equal 1, msgs.count
assert_equal({
method: "textDocument/publishDiagnostics",
params: {
diagnostics: [
{code: "Layout/ArrayAlignment",
message: "Use one level of indentation for elements following the first line of a multi-line array.",
range: {start: {character: 3, line: 2}, end: {character: 3, line: 2}},
severity: 3,
source: "standard"},
{code: "Layout/ExtraSpacing",
message: "Unnecessary spacing detected.",
range: {start: {character: 4, line: 2}, end: {character: 4, line: 2}},
severity: 3,
source: "standard"},
{code: "Layout/SpaceInsideArrayLiteralBrackets",
message: "Do not use space inside array brackets.",
range: {start: {character: 4, line: 2}, end: {character: 5, line: 2}},
severity: 3,
source: "standard"}
],
uri: "file:///path/to/file.rb"
},
jsonrpc: "2.0"
}, msgs.first)
assert_equal 0, msgs.count
end

def test_format
Expand Down

0 comments on commit 9917773

Please sign in to comment.