Review Request 128290: More flexible API to let language plugins when and how quickly to re-parse documents
Sven Brauch
mail at svenbrauch.de
Mon Jun 27 20:46:28 UTC 2016
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128290/
-----------------------------------------------------------
(Updated June 27, 2016, 8:46 p.m.)
Review request for KDevelop and Kevin Funk.
Changes
-------
fixed milians issues
Repository: kdevplatform
Description
-------
This replaces the whitespaceSensitivity() API which allowed languages to decide whether they are sensitive to whitespace changes, and instead introduces a function
virtual int suggestedReparseDelayForChange(KTextEditor::Document* doc, const KTextEditor::Range& changedRange,
const QString& changedText, bool removal) const;
in ILanguageSupport which can be overriden. Languages can choose that the signalled change does not require an update at all (white-space in some languages), that an update should happen with the default delay, or give a custom delay in ms. The default implementation indicates an update with the default delay if the change was not whitespace-only or was whitespace but adjacent to a word.
In kdev-clang, this enables us to do something like
int ClangSupport::suggestedReparseDelayForChange(KTextEditor::Document* /*doc*/, const KTextEditor::Range& /*changedRange*/,
const QString& changedText, bool /*removal*/) const
{
if ( changedText.contains(QLatin1Char('\n')) || changedText.contains(QLatin1Char(';')) ) {
return ILanguageSupport::DefaultDelay;
}
return 3000;
}
(will submit separately), which makes completion feel much more snappy (Kevin knows ;)). I actually think I will do something similar in kdev-python, namely recommend an instant re-parse when a newline is added.
Diffs (updated)
-----
language/backgroundparser/backgroundparser.h bf22d38
language/backgroundparser/backgroundparser.cpp 84e4011
language/backgroundparser/documentchangetracker.h 079feab
language/backgroundparser/documentchangetracker.cpp 4ddded5
language/interfaces/ilanguagesupport.h 5c3fc30
language/interfaces/ilanguagesupport.cpp 67aab36
Diff: https://git.reviewboard.kde.org/r/128290/diff/
Testing
-------
Thanks,
Sven Brauch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20160627/59e898bc/attachment.html>
More information about the KDevelop-devel
mailing list