Bug 374301

Summary: Code completion should offer variable first
Product: [Applications] kdevelop Reporter: Ian H <master.haber>
Component: Language Support: CPP (Clang-based)Assignee: kdevelop-bugs-null
Status: CONFIRMED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.0.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Ian H 2016-12-29 19:26:47 UTC
When using code completion, it should offer the variable before offering the variable's methods, regardless of what you using it for.

QList<int> values;

int foo=values.at(0);

if you hit the code completion at any point while typing 'values' before the '.', it will complete to 'values.count()'. i think it should probably always have the full variable name be at the top of the offered completion because hitting enter and accepting the first choice shouldnt ever require that you undo what you just did in order to get it right. If it offers the variable first, the worst that would happen is that you have to hit the dot to get the completion again.

This is especially annoying because it seems to be ignoring a huge number of methods for QList, so it doesnt even realize that values.at() exists as a method.
Comment 1 Ian H 2016-12-29 19:42:29 UTC
after offering the variable, it should probably proceed based on most likely by type of assign instead of by alphabetical order.

QVariant data;

QVariantList dataList=data.toList();

in this case, toList() should show up above toLine() because it makes more sense to assign QVariantList to QVariantList than QLine to QVariantList(this would even lead to a compile error)
Comment 2 Kevin Funk 2016-12-30 08:33:13 UTC
Makes sense.