Skip to content

Commit

Permalink
Document highlight shouldn't include the block for a method
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 committed Jul 24, 2024
1 parent c36f1c2 commit 9252aa4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ruby_lsp/listeners/document_highlight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def initialize(response_builder, target, parent, dispatcher)
def on_call_node_enter(node)
return unless matches?(node, [Prism::CallNode, Prism::DefNode])

add_highlight(Constant::DocumentHighlightKind::READ, node.location)
add_highlight(Constant::DocumentHighlightKind::READ, node.message_loc)
end

sig { params(node: Prism::DefNode).void }
Expand Down
36 changes: 36 additions & 0 deletions test/expectations/document_highlight/highlight.exp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"result": [
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 3
}
},
"kind": 2
},
{
"range": {
"start": {
"line": 3,
"character": 0
},
"end": {
"line": 3,
"character": 3
}
},
"kind": 2
}
],
"params": [
{
"line": 0,
"character": 2
}
]
}
5 changes: 5 additions & 0 deletions test/fixtures/highlight.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
foo do
end

foo do
end

0 comments on commit 9252aa4

Please sign in to comment.