Consider using-directives with function implements code-completion
AbandonedPublic

Authored by amhndu on Oct 2 2018, 5:49 PM.

Details

Reviewers
None
Group Reviewers
KDevelop
Summary

When offering code-completion suggestions, the generated code will now take
into account any namespaces explicitly qualified with a using-directive

BUG: 373722

Test Plan

The test_codecompletion tests are broken (as confirmed on IRC),
but an individual test case can be run before the crash
$ ./test_codecompletion testImplement:bug373722-using-directive

Diff Detail

Repository
R32 KDevelop
Branch
implements-fix
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 3447
Build 3465: arc lint + arc unit
amhndu created this revision.Oct 2 2018, 5:49 PM
Restricted Application added a project: KDevelop. · View Herald TranscriptOct 2 2018, 5:49 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald Transcript
amhndu requested review of this revision.Oct 2 2018, 5:49 PM
apol added a subscriber: apol.Oct 2 2018, 11:25 PM

This looks sound but it would be very good if it included a unit test.

amhndu updated this revision to Diff 42772.Oct 3 2018, 4:09 AM

Added a test.
But, as I've mentioned before, the tests for code completion crash,
So I haven't been able to run all tests, though you can run a single test case
before it crashes.

There's another thing, the visitor will keep scanning even past the invocation
point, even though function declarations (and using-directives) after the
invocation point shouldn't be considered while making suggestions. Would it
better to create a new patch and test the file/line to break the visitor ?

amhndu edited the test plan for this revision. (Show Details)Oct 3 2018, 4:13 AM
amhndu abandoned this revision.Oct 12 2018, 1:56 PM

The simple example

namespace A
{
    void foo();
}

using namespace A;

void foo()
{
    std::cout << "foo" << std::endl;
}

Doesn't work, because the function definition doesn't implement ::A::foo but ::foo. Although it would work in some other cases... I figure it's not worth supporting.