Search in sources :

Example 1 with ModelFindService

use of org.erlide.engine.services.search.ModelFindService in project erlide_eclipse by erlang.

the class ErlangCompletionService method getExternalCallCompletions.

List<CompletionData> getExternalCallCompletions(final IOtpRpc b, final String moduleName0, final int offset, final String prefix, final boolean arityOnly) throws CoreException {
    final ModelFindService modelFindService = ErlangEngine.getInstance().getModelFindService();
    final String moduleName = modelFindService.resolveMacroValue(moduleName0, module);
    // we have an external call
    final List<CompletionData> result = new ArrayList<>();
    final IErlElementLocator model = ErlangEngine.getInstance().getModel();
    final IErlModule theModule = modelFindService.findModule(model, project, moduleName, null, IErlElementLocator.Scope.ALL_PROJECTS);
    // FIXME or IErlElementLocator.Scope.REFERENCED_PROJECTS
    if (theModule != null) {
        if (ErlangEngine.getInstance().getModelUtilService().isOtpModule(theModule)) {
            final OtpErlangObject res = ErlangEngine.getInstance().getOtpDocService().getProposalsWithDoc(b, moduleName, prefix);
            addFunctionProposalsWithDoc(offset, prefix, result, res, null, arityOnly);
        } else {
            addFunctionsFromModule(offset, prefix, arityOnly, result, theModule);
        }
    }
    return result;
}
Also used : CompletionData(org.erlide.engine.services.codeassist.CompletionData) FunctionCompletionData(org.erlide.engine.services.codeassist.FunctionCompletionData) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) ArrayList(java.util.ArrayList) IErlModule(org.erlide.engine.model.root.IErlModule) ModelFindService(org.erlide.engine.services.search.ModelFindService) IErlElementLocator(org.erlide.engine.model.root.IErlElementLocator) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Aggregations

OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)1 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)1 ArrayList (java.util.ArrayList)1 IErlElementLocator (org.erlide.engine.model.root.IErlElementLocator)1 IErlModule (org.erlide.engine.model.root.IErlModule)1 CompletionData (org.erlide.engine.services.codeassist.CompletionData)1 FunctionCompletionData (org.erlide.engine.services.codeassist.FunctionCompletionData)1 ModelFindService (org.erlide.engine.services.search.ModelFindService)1