Beispiel #1
0
void CodeCompleter::tryDotArrowCorrectionIfNoResults(ClangCodeCompleteResults &results,
                                                     uint line,
                                                     uint column)
{
    if (results.hasNoResultsForDotCompletion()) {
        const UnsavedFile &theUnsavedFile = unsavedFile();
        bool positionIsOk = false;
        const uint dotPosition = theUnsavedFile.toUtf8Position(line, column - 1, &positionIsOk);
        if (positionIsOk && theUnsavedFile.hasCharacterAt(dotPosition, '.'))
            results = completeWithArrowInsteadOfDot(line, column, dotPosition);
    }
}
Beispiel #2
0
CodeCompletions CodeCompleter::complete(uint line, uint column)
{
    neededCorrection_ = CompletionCorrection::NoCorrection;

    ClangCodeCompleteResults results = complete(line,
                                                column,
                                                translationUnit.cxUnsavedFiles(),
                                                translationUnit.unsavedFilesCount());

    if (results.hasNoResultsForDotCompletion() && hasDotAt(line, column - 1))
        results = completeWithArrowInsteadOfDot(line, column);

    return toCodeCompletions(results);
}