Class: Rcodetools::XMPCompletionEmacsIciclesFilter

Inherits:
XMPCompletionEmacsFilter show all
Defined in:
lib/rcodetools/completion.rb

Constant Summary

Constants included from ProcessParticularLine

ProcessParticularLine::OPERATOR_CHARS

Constants inherited from XMPFilter

Rcodetools::XMPFilter::INITIALIZE_OPTS, Rcodetools::XMPFilter::INTERPRETER_FORK, Rcodetools::XMPFilter::INTERPRETER_RBTEST, Rcodetools::XMPFilter::INTERPRETER_RUBY, Rcodetools::XMPFilter::MARKER, Rcodetools::XMPFilter::MULTI_LINE_RE, Rcodetools::XMPFilter::SINGLE_LINE_RE, Rcodetools::XMPFilter::VAR, Rcodetools::XMPFilter::VERSION, Rcodetools::XMPFilter::WARNING_RE, Rcodetools::XMPFilter::XMP_RE

Instance Attribute Summary

Attributes inherited from XMPCompletionFilter

#prefix

Instance Method Summary collapse

Methods inherited from XMPCompletionEmacsFilter

#error_code

Methods inherited from XMPCompletionFilter

#___prepare_line, #__prepare_line, #candidates, #candidates_with_class, #magic_help_code, #methods_map_code, #prepare_line, run, #split_method_info

Methods included from ProcessParticularLine

#__magic_help_code, #_handle_brackets, #_handle_do_end, #_handle_keywords, #add_BEGIN, #aref_or_aset?, #current_phrase, #fill_literal!, #runtime_data, #runtime_data_with_class, #set_expr_and_postfix!, #set_last_word!

Methods inherited from XMPFilter

#add_markers, #annotate, #annotated_line, #annotated_multi_line, #common_path, #debugprint, detect_rbtest, #execute, #execute_popen, #execute_ruby, #execute_script, #execute_tmpfile, #extract_data, #final_decoration, #get_test_method_from_lineno, #initialize, #initialize_for_test_script, #initialize_rbtest, #initialize_rct_fork, #interpreter_command, #oneline_ize, #prepare_line_annotation, run, #windows?

Constructor Details

This class inherits a constructor from Rcodetools::XMPFilter

Instance Method Details

#completion_code(code, lineno, column = nil) ⇒ Object



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'lib/rcodetools/completion.rb', line 357

def completion_code(code, lineno, column=nil)
  elisp = "(progn\n"
  table = "(setq rct-method-completion-table '("
  help_alist = "(setq alist '("
  
  begin
    klass, cands = candidates_with_class(code, lineno, column)
    cands.sort.each do |minfo|
      meth, description = split_method_info(minfo)
      table << format('("%s\\t[%s]") ', meth, description)
      help_alist << format('("%s" . "%s")', meth, description)
    end
    table << "))\n"
    help_alist << "))\n"
  rescue Exception => err
    return error_code(err)
  end
  elisp << table << help_alist
  elisp << %Q[(setq pattern "#{prefix}")\n]
  elisp << %Q[(setq klass "#{klass}")\n]
  elisp << ")"                # /progn
end