Bug 184185

Summary: Add code completion after case statement
Product: [Applications] kdevelop Reporter: Thomas McGuire <mcguire>
Component: Language Support: CPP (old)Assignee: kdevelop-bugs-null
Severity: wishlist CC: olivier.jg
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Thomas McGuire 2009-02-12 23:49:46 UTC
Version:            (using KDE 4.2.0)
OS:                Linux
Installed from:    Compiled From Sources

It would be nice if code completion could be invoked after a case statement, in case of enums, e.g.

void test()
    enum testEnum { foo, bar };
    switch( testEnum ) {
        case <cursor>

Now, it should offer me foo and bar.
Comment 1 Milian Wolff 2009-08-05 16:43:37 UTC
Additionally "normal" code completion should work:

switch ( someThingIDontCareAbout ) {
  case SomeThingIKnow::<cursor>

Now it should offer me all members of SomeThingIKnow which have a type which is usable as a switch case (i.e. int, enum, ...).
Comment 2 Olivier.jg 2010-12-19 06:59:40 UTC
This has been fixed for a while.
Comment 3 Thomas McGuire 2010-12-24 16:09:17 UTC
Hmm, this is not properly fixed for me.
In the case of my inital comment, I expect "foo" and "bar" to be on the top of the completion list.
Instead, I see "testEnum" on the top, which in this context doesn't make sense. I can not see "foo" or "bar" in the list, instead there is a big list of global declarations (maybe foo and bar are in there somewhere, but the list is too big to scan).

The enum values should be on top of the completion list popup here.
Comment 4 Olivier.jg 2011-07-06 03:02:03 UTC
Git commit 1e7d82145142b948cd42d0e6c035d6b33eb825e1 by Olivier JG.
Committed on 06/07/2011 at 04:57.
Pushed by olivierjg into branch 'master'.

Create a context for switch expression, add special completion for "case"
BUG: 184185
REVIEW: 101671

M  +33   -1    languages/cpp/codecompletion/context.cpp     
M  +1    -0    languages/cpp/codecompletion/context.h     
M  +18   -0    languages/cpp/cppduchain/contextbuilder.cpp     
M  +1    -0    languages/cpp/cppduchain/contextbuilder.h     
M  +14   -0    languages/cpp/tests/test_cppcodecompletion.cpp     
M  +1    -0    languages/cpp/tests/test_cppcodecompletion.h