code completion popup populating

René J.V. Bertin rjvbertin at gmail.com
Sun Mar 10 22:18:05 GMT 2019


On Sunday March 10 2019 19:52:11 Milian Wolff wrote:

> than X ms or something like that. That should solve your specific issue. For 

Probably. Or the list could be unsorted, with items appended to it as they come in. That should ensure that the item under the cursor doesn't change, but is there any meaning to the order in which items are added to the completion list?

> me, I don't think the items get added after pressing enter. Rather, I press 
> enter shortly after the item got added and then the wrong item gets inserted.

Yes, I probably should have said something like "between the instant I decide to hit enter and the moment I've actually pressed the key down far enough".

> Are you up for that?

As far as I can tell this would require hacking in KTextEditor because that's where the popup is constructed, shown etc.

But it may not even be necessary. I can't find the message I thought I had posted about this, so here's once more what I've been testing for a week now:

diff --git kdevplatform/language/codecompletion/codecompletionmodel.cpp kdevplatform/language/codecompletion/codecompletionmodel.cpp
index 2e3520699fd792969e60a320ed6f0c13e0323234..19a63faf8653f15105e2c1e989a6cd4d1f1eceda 100644
--- kdevplatform/language/codecompletion/codecompletionmodel.cpp
+++ kdevplatform/language/codecompletion/codecompletionmodel.cpp
@@ -96,7 +96,7 @@ void CodeCompletionModel::setForceWaitForModel(bool wait)
 
 CodeCompletionModel::CodeCompletionModel( QObject * parent )
   : KTextEditor::CodeCompletionModel(parent)
-  , m_forceWaitForModel(false)
+  , m_forceWaitForModel(true)
   , m_fullCompletion(true)
   , m_mutex(new QMutex)
   , m_thread(nullptr)

I haven't been doing a lot of coding this week (and it's surprisingly hard to remember in what context the completion popup wasn't working reliably for me). This does seem to do exactly what the variable name promises though; I haven't seen the popup being populated "live" since I made this change.

It'd be nice if others test this setting for a while too in their workflow, to see if it improves the completion interface behaviour reliably and without side-effects.

R.


More information about the KDevelop-devel mailing list