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;
}
Aggregations