Review Request: Feature: Lookahead Match Completions

Olivier Jean de Gaalon olivier.jg at gmail.com
Fri Nov 16 13:31:57 UTC 2012



> On Nov. 15, 2012, 9:15 p.m., Milian Wolff wrote:
> >
> 
> Milian Wolff wrote:
>     Forgot to add some comment:
>     
>     First up, great work! I really want to try it out. I esp. wonder about the relatively arbitrary limit of 5 items... Anyhow, once you resolve the few small issues below I'd say we can merge that into master and see how it works for us.
>     
>     BTW: At DevDays conference, I talked with Olivier Goffart about KDevelop and this feature and he suggested something that might be very useful (but should be done in a separate patch set):
>     
>     <pre>
>     int width = // assume code completion here, or:
>     
>     void foo(int width);
>     ...
>     foo(/* assume code completion here*/);
>     </pre>
>     
>     In both cases, we look for something that is a width. Can't we make use of that information somehow in our code completion grouping? It's of course not straight forward, but could be very useful in some cases. Handling stuff like "fooBarWidth = " though might become harder. Same for "QRect().w()" or such abbreviated function names.

I'm also a little ambivalent about the arbitrary 5 item limit. Now that I regroup the items, perhaps I should try again without it.

As far as "something that might be very useful"... perhaps I'm not understanding correctly, because afaict that's exactly what this patch is doing ;).
At any time that we know a match type (which includes both of those cases), we find lookahead matches. We also match the types of all non-lookahead matches and the best matches float to the top. This patch probably also fixes some bugs in that, incidentally.


- Olivier Jean de


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107200/#review22056
-----------------------------------------------------------


On Nov. 4, 2012, 5:54 p.m., Olivier Jean de Gaalon wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107200/
> -----------------------------------------------------------
> 
> (Updated Nov. 4, 2012, 5:54 p.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Description
> -------
> 
> Add a new feature which looks though existing completions for instances of classes, and looks in those classes for declarations which match the desired type. In other words:
> ------------
> struct foo
> {
>   int a;
> };
> int main()
> {
>   foo myFoo;
>   int myInt = //offers myFoo.a
> }
> ------------
> 
> In my testing, in the worst case (large file, lots of visible declarations), this takes under 60 ms for me. In most cases it will probably be much less.
> 
> 
> Diffs
> -----
> 
>   languages/cpp/codecompletion/context.h b6fb017 
>   languages/cpp/codecompletion/context.cpp 6d9c3cc 
>   languages/cpp/codecompletion/item.h c220753 
>   languages/cpp/codecompletion/item.cpp 2514f9a 
>   languages/cpp/tests/test_cppcodecompletion.h 574de0f 
>   languages/cpp/tests/test_cppcodecompletion.cpp 88a0df7 
> 
> Diff: http://git.reviewboard.kde.org/r/107200/diff/
> 
> 
> Testing
> -------
> 
> Added unit tests, usage.
> 
> 
> Thanks,
> 
> Olivier Jean de Gaalon
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20121116/21d07f44/attachment.html>


More information about the KDevelop-devel mailing list