need help with completion problem (no widget shown even though items are found)

Milian Wolff mail at milianw.de
Sat Aug 15 19:09:48 UTC 2009


David Nolden, 14.08.2009:
> Am Donnerstag 13 August 2009 23:48:42 schrieb Milian Wolff:
> > I got such a strange problem I cannot debug it / fix it myself:
> >
> > You can observe the bug in a recent enough version of the PHP plugin:
> >
> > - open a php file in any project
> > - the project should have at least a subfolder in the dir of the php file
> > - that subfolder should have some contents
>
> Is it possible that those entries are simply filtered away by the
> completion- widget? Everything in the completion-list has to start with the
> string returned by your implementation of
> "CodeCompletionControllerInterface::filterText(..)".

OK - will have a look at it now. Thanks for the hint.

> By the way I also notice that this case was partially broken in C++. Tt
> does not automatically continue the completion for the subfolder any more
> when you execute them. This was working some time, so maybe you've broken
> it while moving that stuff into kdevplatform.
>
> So when you fix it for php, please also take a look at C++ so it works
> there as well.

As we talked on IRC about that I doubt that this ever worked. I tried to copy 
the invokation of code completion from your missing include stuff into a 
method. Then I called that at the end of execute() if a dir got executed. But 
nothing showed up. Debugging it I saw that the view was not updated at that 
point and I think that would be required for proper code completion. Also take 
a look at the CLI output:

kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: completion invoked 
for context 0xab9d3830                      
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: "" [ (0, 0)  ->  
(168, 0) ]                                    
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: Found context is not 
current. Its revision is                  
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: apply 
specialization: (27, 10)                                 
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: context at (27, 10) 
: 0xab9d3830 "" [ (0, 0)  ->  (168, 0) ]   
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: after 
specialization: "" [ (0, 0)  ->  (168, 0) ]              
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: context is set to 
0xab9d3830                                   
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionWorker::computeCompletions: ""                                                                   
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionWorker::computeCompletions: added text: ""                                                       
kdevelop(23627)/kdevplatform (language) 
KDevelop::BackgroundParserPrivate::parseDocumentsInternal: creating job from 
delayed job                                 
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::foundDeclarations: got completion-context with  
0 ungrouped elements                      
kdevelop(23627)/kdevplatform (language)
#### executing directory yields the stuff below
KDevelop::CodeCompletionModel::completionInvokedInternal: completion invoked 
for context 0xab9d3830                      
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: "" [ (0, 0)  ->  
(168, 0) ]                                    
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: Found context is not 
current. Its revision is                  
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: apply 
specialization: (27, 27)                                 
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: context at (27, 27) 
: 0xab9d3830 "" [ (0, 0)  ->  (168, 0) ]   
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: after 
specialization: "" [ (0, 0)  ->  (168, 0) ]              
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: context is set to 
0xab9d3830                                   
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionWorker::computeCompletions: ""                                                                   
kdevelop(23627)/kdevplatform (language) 
KDevelop::CodeCompletionWorker::computeCompletions: added text: ""  

It looks like the same code completion context is chosen (same pointer 
addresses). Could I delay the invokation somehow? Or do you have any other 
ideas?

Here's the code I put into item.cpp right after doing document->replace() in 
the execute method of the file item:

  if ( includeItem.isDirectory ) {
    // restart code completion
    if ( document->activeView() && document->activeView()->hasFocus() ) {
      KTextEditor::CodeCompletionInterface* iface = 
dynamic_cast<KTextEditor::CodeCompletionInterface*>(document->activeView());
      if ( iface ) {
        ///@todo 1. This is a non-public interface, and 2. Completion should 
be started in "automatic invocation" mode
        QMetaObject::invokeMethod(document->activeView(), 
"userInvokedCompletion");
      }
    }
  }

and don't forget to include ktexteditor/codecompletioninterface.h.

-- 
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: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090815/00843e1a/attachment.sig>


More information about the KDevelop-devel mailing list