Bug 271007

Summary: Bad code completion from empty assignment to enum type
Product: [Applications] kdevelop Reporter: Nicolás Alvarez <nalvarez>
Component: Language Support: CPP (old)Assignee: kdevelop-bugs-null
Status: RESOLVED DUPLICATE    
Severity: normal CC: olivier.jg
Priority: HI    
Version: 4.2.1   
Target Milestone: 4.2.0   
Platform: Unlisted Binaries   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nicolás Alvarez 2011-04-15 05:08:08 UTC
In this code snippet:

enum Foo {
    FooOne,
    FooTwo,
    FooThree
};

int main() {
    Foo x = 
}

invoking code completion after the assignment doesn't give very useful results. (note this is only if I didn't type *anything* after the equals sign! see last paragraph)

Under 'Best Matches', I get "Foo" as the only option. This makes little sense; why would you want to write the type name in this context?

That option is followed by a long list of functions and types in the global scope. Only *after* that (ie. near the end of the entire completion list), I get an unnamed group containing all enumerated values in scope. The three ones from the Foo enum are shown in green, like best matches usually are. However, the ones from Foo aren't even at the beginning of that unnamed group in the completion results (the whole group is sorted alphabetically).

If I simply type an 'F', ie. getting a completion of "Foo x = F", it shows almost the expected best matches: the Foo type, and the FooOne, FooThree, and FooTwo values. The enum type still shouldn't be there, but at least now the values show as they should.
Comment 1 Milian Wolff 2011-04-15 11:54:55 UTC
very true, I'm bugged by this very often as well.
Comment 2 Olivier.jg 2011-06-09 08:23:46 UTC
Same as 271083

*** This bug has been marked as a duplicate of bug 271083 ***