Bug 184185 - Add code completion after case statement
Summary: Add code completion after case statement
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Compiled Sources Linux
: NOR wishlist (vote)
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-12 23:49 UTC by Thomas McGuire
Modified: 2011-07-06 03:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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     

http://commits.kde.org/kdevelop/1e7d82145142b948cd42d0e6c035d6b33eb825e1