diff --git a/lib/ruby_lsp/event_emitter.rb b/lib/ruby_lsp/event_emitter.rb index a058377424..53d2c5df95 100644 --- a/lib/ruby_lsp/event_emitter.rb +++ b/lib/ruby_lsp/event_emitter.rb @@ -53,7 +53,7 @@ def emit_for_target(node) sig { override.params(node: T.nilable(SyntaxTree::Node)).void } def visit(node) - @listeners[:on_visit]&.each { |l| T.unsafe(l).on_visit(node) } + @listeners[:on_node]&.each { |l| T.unsafe(l).on_node(node) } super end diff --git a/lib/ruby_lsp/requests/folding_ranges.rb b/lib/ruby_lsp/requests/folding_ranges.rb index 3592afee1c..9f17400923 100644 --- a/lib/ruby_lsp/requests/folding_ranges.rb +++ b/lib/ruby_lsp/requests/folding_ranges.rb @@ -68,11 +68,11 @@ def initialize(emitter, message_queue) @response = T.let([], ResponseType) @partial_range = T.let(nil, T.nilable(PartialRange)) - emitter.register(self, :on_visit) + emitter.register(self, :on_node) end sig { params(node: T.nilable(SyntaxTree::Node)).returns(T.untyped) } # TODO: fix sig - def on_visit(node) + def on_node(node) visit(node) emit_partial_range end