Search in sources :

Example 1 with FunctionCompletionData

use of org.erlide.engine.services.codeassist.FunctionCompletionData in project erlide_eclipse by erlang.

the class AbstractErlContentAssistProcessor method toProposal.

protected ICompletionProposal toProposal(final CompletionData data) {
    if (data instanceof FunctionCompletionData) {
        final FunctionCompletionData fdata = (FunctionCompletionData) data;
        String info = fdata.getAdditionalProposalInfo();
        StringBuffer buffer = new StringBuffer(info == null ? "" : info);
        return new ErlCompletionProposal(fdata.getOffsetsAndLengths(), fdata.getDisplayString(), fdata.getReplacementString(), fdata.getReplacementOffset(), fdata.getReplacementLength(), fdata.getCursorPosition(), null, null, HoverUtil.getHTML(buffer), sourceViewer);
    }
    return new CompletionProposal(data.getReplacementString(), data.getReplacementOffset(), data.getReplacementLength(), data.getCursorPosition());
}
Also used : FunctionCompletionData(org.erlide.engine.services.codeassist.FunctionCompletionData) CompletionProposal(org.eclipse.jface.text.contentassist.CompletionProposal) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal)

Example 2 with FunctionCompletionData

use of org.erlide.engine.services.codeassist.FunctionCompletionData in project erlide_eclipse by erlang.

the class ErlangCompletionService method addFunctionCompletion.

protected void addFunctionCompletion(final int offset, final List<CompletionData> result, final String funWithArity, final String docStr, final String funWithParameters, final List<Location> offsetsAndLengths) {
    int cursorPosition = funWithParameters.length();
    if (!offsetsAndLengths.isEmpty()) {
        cursorPosition = offsetsAndLengths.get(0).getOffset();
    }
    // first check if it's already there...
    for (final CompletionData c : result) {
        if (c.getDisplayString().equals(funWithArity)) {
            return;
        }
    }
    final CompletionData c = new FunctionCompletionData(offsetsAndLengths, funWithArity, funWithParameters, offset, 0, cursorPosition, docStr);
    result.add(c);
}
Also used : CompletionData(org.erlide.engine.services.codeassist.CompletionData) FunctionCompletionData(org.erlide.engine.services.codeassist.FunctionCompletionData) FunctionCompletionData(org.erlide.engine.services.codeassist.FunctionCompletionData)

Aggregations

FunctionCompletionData (org.erlide.engine.services.codeassist.FunctionCompletionData)2 CompletionProposal (org.eclipse.jface.text.contentassist.CompletionProposal)1 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)1 CompletionData (org.erlide.engine.services.codeassist.CompletionData)1