Skip to content

Commit

Permalink
Merge pull request #9 from ruby/fix_symbol_completion_exception
Browse files Browse the repository at this point in the history
Fix exception in symbol completion
  • Loading branch information
tompng authored Dec 21, 2023
2 parents da82da4 + 9a204fd commit de008f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/repl_type_completor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def analyze_code(code, binding = Object::TOPLEVEL_BINDING)
[call_node.name, target_node.content]
end
when Prism::SymbolNode
return unless !target_node.closing || target_node.empty?
return unless !target_node.closing || target_node.closing.empty?

name = target_node.value.to_s
if parents.last.is_a? Prism::BlockArgumentNode # method(&:target)
Expand Down
7 changes: 7 additions & 0 deletions test/repl_type_completor/test_repl_type_completor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ def setup
ReplTypeCompletor.load_rbs unless ReplTypeCompletor.rbs_loaded?
end

def teardown
if ReplTypeCompletor.last_completion_error
raise ReplTypeCompletor.last_completion_error
ReplTypeCompletor.instance_variable_set(:@last_completion_error, nil)
end
end

def empty_binding
binding
end
Expand Down

0 comments on commit de008f3

Please sign in to comment.