Review Request 128290: More flexible API to let language plugins when and how quickly to re-parse documents

Milian Wolff mail at milianw.de
Tue Jun 28 08:26:55 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128290/#review96907
-----------------------------------------------------------




language/backgroundparser/documentchangetracker.cpp (line 154)
<https://git.reviewboard.kde.org/r/128290/#comment65491>

    ah right, minimum would potentially return the negative values - I see. keep it as is then but please add a comment for that


- Milian Wolff


On June 27, 2016, 8:46 p.m., Sven Brauch wrote:
> 
> -----------------------------------------------------------
> 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.
> 
> 
> 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
> -----
> 
>   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/20160628/12c22039/attachment.html>


More information about the KDevelop-devel mailing list