|
From: Christopher W. <caw...@us...> - 2005-11-29 02:20:20
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24221/src/org/rubypeople/rdt/internal/ui/text/ruby Modified Files: RubyCompletionProcessor.java Log Message: a temporary hack for suggesting Kernel methods in our completion processor - it's a hack because it's hardcoded method names in a statis array. We should determine the methods by asking the interpreter (when a user selects one). We should also think about making special completions for methods (expect the right number of arguments/block). Index: RubyCompletionProcessor.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyCompletionProcessor.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** RubyCompletionProcessor.java 1 Apr 2005 01:59:21 -0000 1.13 --- RubyCompletionProcessor.java 29 Nov 2005 02:20:12 -0000 1.14 *************** *** 42,45 **** --- 42,58 ---- "PID for ruby interpreter", "status of the latest executed child process", "array of paths that ruby interpreter searches for files"}; + // FIXME This is an ugly hack, just hard-coding method names + // FIXME Create a model for Ruby core in our Ruby Model! + private static String[] KERNEL_METHODS = {"abort", "at_exit", "autoload", "binding", + "block_given?", "callcc", "caller", "catch", "chomp", + "chomp!", "chop", "chop!", "eval", "exec", "exit", + "exit!", "fail", "fork", "format", "gets", "global_variables", + "gsub", "gsub!", "iterator?", "lambda", "load", "local_variables", + "loop", "open", "p", "print", "printf", "proc", "putc", + "puts", "raise", "rand", "readline", "readlines", "require", + "scan", "select", "set_trace_func", "singleton_method_added", + "sleep", "split", "sprintf", "srand", "sub", "sub!", "syscall", + "system", "test", "throw", "trace_var", "trap", "untrace_var"}; + /** * The prefix for the current content assist *************** *** 101,105 **** private ICompletionProposal[] determineRubyElementProposals(ITextViewer viewer, int documentOffset) { ArrayList completionProposals = new ArrayList(getDocumentsRubyElements()); ! String prefix = getCurrentPrefix(viewer.getDocument().get(), documentOffset); // following the JDT convention, if there's no text already entered, --- 114,119 ---- private ICompletionProposal[] determineRubyElementProposals(ITextViewer viewer, int documentOffset) { ArrayList completionProposals = new ArrayList(getDocumentsRubyElements()); ! completionProposals.addAll(addKernelMethods()); ! String prefix = getCurrentPrefix(viewer.getDocument().get(), documentOffset); // following the JDT convention, if there's no text already entered, *************** *** 108,113 **** // FIXME Add elements from required/loaded files! } ! ! ArrayList possibleProposals = new ArrayList(); for (int i = 0; i < completionProposals.size(); i++) { String proposal = (String) completionProposals.get(i); --- 122,127 ---- // FIXME Add elements from required/loaded files! } ! ! ArrayList possibleProposals = new ArrayList(); for (int i = 0; i < completionProposals.size(); i++) { String proposal = (String) completionProposals.get(i); *************** *** 123,126 **** --- 137,148 ---- } + private List addKernelMethods() { + List kernelProposals = new ArrayList(); + for (int i = 0; i < KERNEL_METHODS.length; i++) { + kernelProposals.add(KERNEL_METHODS[i]); + } + return kernelProposals; + } + /* * (non-Javadoc) |