Code-Completion with $ in variable names

David Nolden zwabel at googlemail.com
Fri Oct 31 16:57:23 UTC 2008


Am Freitag, 31. Oktober 2008 17:46:28 schrieb Niko Sams:
> Hi,
>
> As all variables in Php start with a $ I'm facing some problems for
> code completion.
> I'm not sure where to solve them.
>
> - I don't store as identifier for the variable the $
> - In CompletionItem::data I add the $ for DisplayRole
>
> In KateCompletionWidget::determineRange() the range is reported without $,
> so I tweaked that regular expression to include $ there:

I've talked about that at some point with Hamish, and we aggreed that we need 
that regular expression to be specified by the completion-model with the 
start of each completion, for example there's similar problems when doing 
include-completion. So we need a way to do that. Although your fix probably 
at least won't break C++ completion.

> (I also removed the _ as it is included in \w)
> Is this change Ok?
Should be fine, if it is like that. No time to look into it right now. :)

> Next problem (with this patch applied) is when executing the - the $ is
> missing.
You mean when you execute the completion-item? That shouldn't be a problem, 
you can just define your own "execute" function, to add the $ if needed.

So if you feel like "fixing" the real problem, you could implement something 
in kate so each completion-model can specify an own regular expression to 
determine the used range. Else, the your patch should be fine as well from 
what I know.

Greetings, David




More information about the KDevelop-devel mailing list