Class: Rcodetools::XMPCompletionEmacsFilter

Inherits:
XMPCompletionFilter 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 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



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# File 'lib/rcodetools/completion.rb', line 322

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

#error_code(err) ⇒ Object



343
344
345
346
347
348
349
350
351
# File 'lib/rcodetools/completion.rb', line 343

def error_code(err)
  case err
  when NoCandidates
    %Q[(error "#{err.message}")]
  else
    %Q[(error "#{err.message}\n#{err.backtrace.join("\n")}")]
  end

end