Module: RubyLanguageServer::ScopeParserCommands::RakeCommands

Included in:
RubyLanguageServer::SEXPProcessor
Defined in:
lib/ruby_language_server/scope_parser_commands/rake_commands.rb

Instance Method Summary collapse

Instance Method Details

#on_namespace_command(line, args, rest) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ruby_language_server/scope_parser_commands/rake_commands.rb', line 18

def on_namespace_command(line, args, rest)
  # OMG.  Rake commands can have like any form.
  # The most reliable way I can see to name them is to grab the string
  # I *so* do not want to hear about it when it doesn't work.
  name = rest.flatten.detect { |o| o.instance_of?(String) }
  # add_scope(args, rest, ScopeData::Scope::TYPE_METHOD)
  push_scope(ScopeData::Scope::TYPE_MODULE, name, line, 0, false)
  process(args)
  process(rest)
  # We push a scope and don't pop it because we're called inside on_method_add_block
end

#on_task_command(line, args, rest) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ruby_language_server/scope_parser_commands/rake_commands.rb', line 6

def on_task_command(line, args, rest)
  # OMG.  Rake commands can have like any form.
  # The most reliable way I can see to name them is to grab the string
  # I *so* do not want to hear about it when it doesn't work.
  name = rest.flatten.detect { |o| o.instance_of?(String) }
  # add_scope(args, rest, ScopeData::Scope::TYPE_METHOD)
  push_scope(ScopeData::Scope::TYPE_MODULE, name, line, 0, false)
  process(args)
  process(rest)
  # We push a scope and don't pop it because we're called inside on_method_add_block
end