Fast code completion

Milian Wolff mail at milianw.de
Fri Feb 7 20:48:52 GMT 2020


On Dienstag, 4. Februar 2020 15:07:41 CET Thomas Schöps wrote:
> A somewhat off-topic comment to the following:
> 
> On 2/3/20 9:37 PM, Milian Wolff wrote:
> > Even today we have many (valid, imo) concerns that code completion
> > isn't fast enough. And this is pretty much the most important feature
> > of KDevelop for me...
> 
> I might be wrong on this or it might be outdated, but when I checked
> some time ago, I had the impression that KDevelop always needs to wait
> for a potential current parse process for a file to finish before
> invoking code completion. This seemed like it heavily increased the
> latency until code completion was available in most cases (i.e., unless
> code completion was triggered for an already-parsed document by pressing
> Ctrl-Space somewhere, for example).

Cool, thanks for sharing this trick. Sounds like this could help a lot indeed, 
at the cost of increased resource consumption. But I do indeed think this 
should be done for KDevelop too - definitely something for me to try out!

> For a couple of reasons, I decided to write my own IDE (
> https://github.com/puzzlepaint/cide ). Inspired by QtCreator, it keeps
> two libclang translation units (with the same settings) around for each
> file that is edited, and it only (alternatingly) applies parsing to one
> of them at each time. This way, the other translation unit is always
> available for clang_codeCompleteAt(), which seems to run near-instantly
> even for translation units that are not fully up-to-date. Thus, code
> completion is always fast.

Cool project :) Have fun! And while I somewhat agree with Kevin, I do see why 
one would potentially want to start off with a clean state instead of trying 
to grog KDevelop. Yet one big suggestion from my side is definitely to at 
least reuse KTextEditor. That also works on Windows and Mac, if that matters, 
and will instantly give you a really good editor component. Then you can 
concentrate on the rest.

> If my observation was right that KDevelop does not do it this way, then
> I think that this might be the #1 change that could help to drastically
> reduce the code completion delay.

Indeed, thanks!

-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20200207/eddf9c41/attachment.sig>


More information about the KDevelop-devel mailing list