Beispiel #1
0
ClangCodeCompleteResults CodeCompleter::completeWithArrowInsteadOfDot(uint line,
                                                                      uint column,
                                                                      uint dotPosition)
{
    ClangCodeCompleteResults results;
    const bool replaced = unsavedFile().replaceAt(dotPosition,
                                                  1,
                                                  Utf8StringLiteral("->"));

    if (replaced) {
        results = completeHelper(line, column + 1);
        if (results.hasResults())
            neededCorrection_ = CompletionCorrection::DotToArrowCorrection;
        filterUnknownContextResults(results, unsavedFile(), line, column+1);
    }

    return results;
}
Beispiel #2
0
ClangCodeCompleteResults CodeCompleter::completeWithArrowInsteadOfDot(uint line, uint column)
{
    ClangCodeCompleteResults results;

    const SourceLocation location = translationUnit.sourceLocationAtWithoutReparsing(line, column - 1);
    const bool replaced = translationUnit.unsavedFile().replaceAt(location.offset(),
                                                                  1,
                                                                  Utf8StringLiteral("->"));

    if (replaced) {
        results = complete(line,
                           column + 1,
                           translationUnit.cxUnsavedFiles(),
                           translationUnit.unsavedFilesCount());

        if (results.hasResults())
            neededCorrection_ = CompletionCorrection::DotToArrowCorrection;
    }

    return results;
}