Package org.cx4a.rsense.CodeCompletionResult

Examples of org.cx4a.rsense.CodeCompletionResult.CompletionCandidate


            List<CompletionCandidate> candidates = new ArrayList<CompletionCandidate>();
            for (IRubyObject receiver : context.typeSet) {
                RubyClass rubyClass = receiver.getMetaClass();
                for (String name : rubyClass.getMethods(true)) {
                    DynamicMethod method = rubyClass.searchMethod(name);
                    candidates.add(new CompletionCandidate(name,
                                                           method.toString(),
                                                           method.getModule().getMethodPath(null),
                                                           CompletionCandidate.Kind.METHOD));
                }
                if (receiver instanceof RubyModule) {
                    RubyModule module = ((RubyModule) receiver);
                    for (String name : module.getConstants(true)) {
                        RubyModule directModule = module.getConstantModule(name);
                        IRubyObject constant = directModule.getConstant(name);
                        String baseName = directModule.toString();
                        String qname = baseName + "::" + name;
                        CompletionCandidate.Kind kind
                            = (constant instanceof RubyClass)
                            ? CompletionCandidate.Kind.CLASS
                            : (constant instanceof RubyModule)
                            ? CompletionCandidate.Kind.MODULE
                            : CompletionCandidate.Kind.CONSTANT;
                        candidates.add(new CompletionCandidate(name, qname, baseName, kind));
                    }
                }
            }

            result.setCandidates(candidates);
View Full Code Here

TOP

Related Classes of org.cx4a.rsense.CodeCompletionResult.CompletionCandidate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.