@@ -18,9 +18,8 @@ class PrismProcessor < Prism::Visitor
1818
1919 attr_reader :current_scope , :lines
2020
21- def initialize ( lines = 1 , shallow = false )
21+ def initialize ( lines = 1 )
2222 @lines = lines
23- @shallow = shallow
2423 @root_scope = nil
2524 @current_scope = nil
2625 @block_names = { }
@@ -87,12 +86,7 @@ def visit_def_node(node)
8786 # Process parameters (adds them as variables in scope)
8887 visit_parameters ( node . parameters ) if node . parameters
8988
90- # Process body only if not shallow
91- if @shallow
92- # Skip body processing
93- else
94- super
95- end
89+ super
9690
9791 pop_scope
9892 scope
@@ -418,7 +412,6 @@ def extract_command_rest(node)
418412 end
419413
420414 def add_variable ( name , line , column , scope = @current_scope )
421- return if @shallow
422415 return if scope . nil?
423416
424417 scope . variables . where ( name :) . first_or_create! (
@@ -467,18 +460,18 @@ def pop_scope
467460 class ScopeParser
468461 attr_reader :root_scope
469462
470- def initialize ( text , shallow = false )
463+ def initialize ( text )
471464 text ||= '' # empty is the same as nil - but it doesn't crash
472465 begin
473466 result = Prism . parse ( text )
474- processor = PrismProcessor . new ( text . split ( "\n " ) . length , shallow )
467+ processor = PrismProcessor . new ( text . split ( "\n " ) . length )
475468 processor . root_scope # Initialize root scope
476469 result . value . accept ( processor )
477470 @root_scope = processor . root_scope
478471 rescue StandardError => e
479472 RubyLanguageServer . logger . error ( "Exception in prism parsing: #{ e } for text: #{ text } " )
480473 # Create an empty root scope on error
481- processor = PrismProcessor . new ( text . split ( "\n " ) . length , shallow )
474+ processor = PrismProcessor . new ( text . split ( "\n " ) . length )
482475 @root_scope = processor . root_scope
483476 end
484477 end
0 commit comments