[prev in list] [next in list] [prev in thread] [next in thread]
List: kdevelop-devel
Subject: Re: Custom range for CodeCompletion
From: "Niko Sams" <niko.sams () gmail ! com>
Date: 2008-11-24 19:11:54
Message-ID: 629542d40811241111o4dd1430fr6c9931e38f4a9170 () mail ! gmail ! com
[Download RAW message or body]
On Mon, Nov 24, 2008 at 12:22 PM, David Nolden <zwabel@googlemail.com> wrote:
> Hi! Good work, really. I was a bit worried about performance, but that
> shouldn't be a problem with your implementation. There's just one thing I
> don't understand: How to actually modify the completion-range or allowed text
> regexp, they're both const & :-)
The signal is emitted by the CodeCompletionModel only when it needs a different
completion-range. This would usually happen in codeCompletionInvoked.
see this example:
void CodeCompletionModel::completionInvokedInternal(KTextEditor::View*
view, const KTextEditor::Range& range, InvocationType invocationType,
const KUrl& url)
{
if (range.start().column() > 0) {
KTextEditor::Range preRange(Cursor(range.start().line(),
range.start().column()-1),
Cursor(range.start().line(),
range.start().column()));
kDebug() << view->document()->text(preRange);
if (view->document()->text(preRange) == "$") {
range.expandToRange(preRange);
kDebug() << "setting new completion range" << range;
emit modifyCompletionRange(range, QRegExp("^\\$(\\w*)"));
}
}
Do you think you way of emitting the signal is better - then I will change it.
> I'm also a bit worried about regressions, since this touched quite fragile
> code. So it needs thorough testing.
I wrote some simple unit-tests for the new code. Not included in the patch as
I don't know yet how to the linking correctly.
Niko
_______________________________________________
KDevelop-devel mailing list
KDevelop-devel@kdevelop.org
https://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic