Custom range for CodeCompletion

Niko Sams niko.sams at gmail.com
Sun Nov 23 13:38:41 UTC 2008


Hi,

Some languages have special characters for example in variable names (as
in php every variable has a $ prefix) or preprocessor directives start with #.
Currently Kate has a hardcoded regluar expression to determine this range.

This patch adds a new signal to the CodeCompletionModel interface:
void modifyCompletionRange(const KTextEditor::Range& word, const
QRegExp& allowedText);

With this every model can have it's own range used for completion.
allowedText is needed
to have a custom regular expression to detect when completion should be aborted.
this is currently hardcoded and also causes problems with $ in variable names.

What is still hardcoded in KateCompletionWidget is when
automaticInvocation should be started.
I think this should be configurable too - though I have no idea how to
do this without adding a
virtual function to CodeCompletionModel.

Please review the patch - especially if it is API and ABI compatible.

Niko




More information about the KDevelop-devel mailing list