Skip to content

Commit

Permalink
Remove comment continuation anchor (#1215)
Browse files Browse the repository at this point in the history
The anchor is only necessary if we need to move the cursor to a
different position than the one where the edit finishes. This is never
the case for comment continuation
  • Loading branch information
vinistock authored Nov 24, 2023
1 parent e5a2c89 commit 0a3bf4f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion lib/ruby_lsp/requests/on_type_formatting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def handle_heredoc_end(delimiter)
sig { params(spaces: String).void }
def handle_comment_line(spaces)
add_edit_with_text("##{spaces}")
move_cursor_to(@position[:line], @indentation + spaces.size + 1)
end

sig { params(text: String, position: Document::PositionShape).void }
Expand Down
12 changes: 0 additions & 12 deletions test/requests/on_type_formatting_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@ def test_comment_continuation
range: { start: { line: 0, character: 14 }, end: { line: 0, character: 14 } },
newText: "# ",
},
{
range: { start: { line: 0, character: 9 }, end: { line: 0, character: 9 } },
newText: "$0",
},
]
assert_equal(expected_edits.to_json, T.must(edits).to_json)
end
Expand Down Expand Up @@ -253,10 +249,6 @@ def test_comment_continuation_with_other_line_break_matches
range: { start: { line: 0, character: 14 }, end: { line: 0, character: 14 } },
newText: "# ",
},
{
range: { start: { line: 0, character: 9 }, end: { line: 0, character: 9 } },
newText: "$0",
},
]
assert_equal(expected_edits.to_json, T.must(edits).to_json)
end
Expand All @@ -282,10 +274,6 @@ def test_comment_continuation_when_inserting_new_line_in_the_middle
range: { start: { line: 0, character: 7 }, end: { line: 0, character: 7 } },
newText: "# ",
},
{
range: { start: { line: 0, character: 2 }, end: { line: 0, character: 2 } },
newText: "$0",
},
]
assert_equal(expected_edits.to_json, T.must(edits).to_json)
end
Expand Down

0 comments on commit 0a3bf4f

Please sign in to comment.