Skip to content

Commit

Permalink
Merge pull request #635 from koic/lsp_diagnostic_range
Browse files Browse the repository at this point in the history
Fix end position of diagnostic for LSP
  • Loading branch information
searls committed Jun 23, 2024
2 parents ad9ca9e + f0df3dd commit de139d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/standard/lsp/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def diagnostic(file_uri, text)
message: msg,
range: {
start: {character: loc[:start_column] - 1, line: loc[:start_line] - 1},
end: {character: loc[:last_column] - 1, line: loc[:last_line] - 1}
end: {character: loc[:last_column], line: loc[:last_line] - 1}
},
severity: severity,
source: "standard"
Expand Down
6 changes: 3 additions & 3 deletions test/standard/runners/lsp_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ def test_did_open
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}},
range: {start: {character: 3, line: 2}, end: {character: 4, line: 2}},
severity: 3,
source: "standard"},
{code: "Layout/ExtraSpacing",
message: "Unnecessary spacing detected.",
range: {start: {character: 4, line: 2}, end: {character: 4, line: 2}},
range: {start: {character: 4, line: 2}, end: {character: 5, 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}},
range: {start: {character: 4, line: 2}, end: {character: 6, line: 2}},
severity: 3,
source: "standard"}
],
Expand Down

0 comments on commit de139d7

Please sign in to comment.