Class: Rcodetools::XMPCompletionEmacsAnythingFilter

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



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/rcodetools/completion.rb', line 384

def completion_code(code, lineno, column=nil)
  elisp = "(progn\n"
  table = "(setq rct-method-completion-table `("
  
  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]" . ,(propertize "%s" \'desc "%s")) ',
        meth, description, meth, description)
    end
    table << "))\n"
  rescue Exception => err
    return error_code(err)
  end
  elisp << table
  elisp << %Q[(setq pattern "#{prefix}")\n]
  elisp << %Q[(setq klass "#{klass}")\n]
  elisp << ")"                # /progn
end