Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
- Add test using hash with slightly more complex formatting
- Cleanup

Co-authored-by: Alexandre Terrasa <[email protected]>
Co-authored-by: Vinicius Stock <[email protected]>
  • Loading branch information
3 people committed Nov 21, 2023
1 parent d98cbcf commit 3d44258
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/ruby_lsp/requests/inlay_hints.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Requests
# var: var, # Label "var" goes here in cases where the value is omitted
# a: "hello",
# }
# `
# ```
class InlayHints < Listener
extend T::Sig
extend T::Generic
Expand All @@ -46,8 +46,7 @@ def initialize(range, dispatcher, message_queue)
@_response = T.let([], ResponseType)
@range = range

dispatcher.register(self, :on_rescue_node_enter)
dispatcher.register(self, :on_implicit_node_enter)
dispatcher.register(self, :on_rescue_node_enter, :on_implicit_node_enter)
end

sig { params(node: Prism::RescueNode).void }
Expand Down
18 changes: 18 additions & 0 deletions test/expectations/inlay_hints/hash_literal_omitted_values.exp.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@
"label": "hello",
"tooltip": "This is a local variable: hello",
"paddingLeft": true
},
{
"position": {
"line": 14,
"character": 8
},
"label": "foo",
"tooltip": "This is a method call. Method name: foo",
"paddingLeft": true
},
{
"position": {
"line": 16,
"character": 9
},
"label": "TEST",
"tooltip": "This is a constant: TEST",
"paddingLeft": true
}
]
}
6 changes: 6 additions & 0 deletions test/fixtures/hash_literal_omitted_values.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@ def foo; end

def test(opts = {}); end
test(foo:, TEST:, hello:)

{
foo:,
bar: "bar",
TEST:,
}
end

0 comments on commit 3d44258

Please sign in to comment.