PHP: context for completion when document is invalid

Niko Sams niko.sams at gmail.com
Thu Feb 5 21:44:59 UTC 2009


On Thu, Feb 5, 2009 at 10:36 PM, David nolden
<david.nolden.kdevelop at art-master.de> wrote:
> Am Donnerstag 05 Februar 2009 22:23:54 schrieb Milian Wolff:
>> 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?
> Looking at the code of findContextAt, it only returns zero if the top-context
> does not contain the position.
>
> So the question is why this happens. Maybe you're making the range of the top-
> context too small.
iface.currentDocument()->documentRange() is used as range.
But as the user types he inserts chars after that range - and because of parsing
errors the range won't be extended.
So the correct solution is what I just deleted in Php :D

> But I think I will add a workaround to completionInvokedInternal for this,
> since this also is a problem in C++ when the cursor is in exactly the last
> position of the document.
having that fix in the platform is the best solution :D

thanks,
Niko




More information about the KDevelop-devel mailing list