PHP: context for completion when document is invalid

Milian Wolff mail at milianw.de
Thu Feb 5 21:23:54 UTC 2009


Hi devs!

With CodeCompletionModel::completionInvokedInternal() moved to kdevplatform 
the PHP plugin again fails to get a proper context for completion when the 
current document is invalid.

For example:

~~~~
<?php
$var = <cursor>
~~~~

Of course this document is invalid and thus no proper context is set. Yet I 
still want to get a context for the code completion (top context?). What I get 
though is:

~~~~
...
kdevelop(20333)/kdevelop (php support) Php::ParseSession::parse: Couldn't 
parse content
kdevelop(20333)/kdevelop (php support) Php::ParseJob::run: ===Failed=== 
"/home/milian/projects/kde4/kdev4-php/circular.php"
kdevelop(20333)/kdevelop (php support) Php::ParseJob::run: 0x9c89ac0
kdevelop(20333)/kdevelop (php support) 
Php::CodeCompletionModel::completionRange: [ (3, 6)  ->  (3, 7) ] " "
kdevelop(20333)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: completion invoked 
for context 0x9c89ac0
kdevelop(20333)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: Found context is not 
current. Its revision is
kdevelop(20333)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: context is set to 
0x0
kdevelop(20333)/kdevplatform (language) 
KDevelop::CodeCompletionModel::completionInvokedInternal: ================== 
NO CONTEXT FOUND =======================
~~~~

Note: no revision is set at all?!

So the main issue: Why is top->findContextAt not finding a proper context? This 
is only happening if the document could not be parsed due to errors. So is the 
PHP language plugin doing something wrong? The Cpp plugin works fine without 
overloading completionInvokedInternal - what does it do differently?

And: could we not fallback to the top-context if findContextAt cannot get a 
proper context? Otoh: shouldn't it at least return the top context?

-- 
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/20090205/0e0ba145/attachment.sig>


More information about the KDevelop-devel mailing list