| Summary: | Alert matching differs from KTextEditor to KSyntaxHighlighting | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-syntax-highlighting | Reporter: | Dominik Haumann <dhaumann> |
| Component: | framework | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | christoph, vkrause |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://commits.kde.org/syntax-highlighting/2475bc4dd2ca94eaaaa4ab98a695d89ac200f5c4 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
| Attachments: | Left: KTextEditor, Right:KSyntaxHighlighting | ||
Created attachment 114534 [details]
Left: KTextEditor, Right:KSyntaxHighlighting
See the different between left KTextEditor and right KSyntaxHighlighting.
This looks like it's caused by a missing space between the alert keyword and the comment marker. I don't have the old version around to compare, but e.g. "/**TODO" with C++ highlighting also doesn't highlight TODO as alert, so this might be a more generic issue. /**TODO */ doesn't highlight in C++ pre-syntax-highlighting here, too. non-doxygen stuff like /*TODO*/ //TODO does The difference might be that the new implementation for the keyword rule also checks if there's a word delimiter before the keyword, not just after it? That's at least if I read the old implementation correctly. If so, that's easy to fix then, just drop that extra check. Hmm, why does it work without the Doxygen hl, e.g. for normal comments? I would assume * is a word delimiter and as /*TODO*/ works, that check is ok. Indeed, * is a delimiter, but # isn't. So this explains the Python difference but nothing related to C++. Presumably we would see the issue with other languages using # as a comment character though, like Bash or Perl. In that case, I am in favor of adding # to the standard delimiters. Or would that be a problem? Seems reasonable, but I can't estimate the impact of this. Maybe run the unit tests with that and see how much breaks? The question is: as that doesn't solve the * case, perhaps one should first take a look why that doesn't work. Or is that just a Doxygen hl glitch? Git commit 2475bc4dd2ca94eaaaa4ab98a695d89ac200f5c4 by Christoph Cullmann. Committed on 01/09/2018 at 08:26. Pushed by cullmann into branch 'master'. avoid word delimiter check at start of keyword Summary: be compatible with old KTextEditor implementation Test Plan: added test for python showing the error works now only other diff in coffee, looks not wrong, function as keyword make && make test Reviewers: vkrause, dhaumann Reviewed By: vkrause Subscribers: kwrite-devel, kde-frameworks-devel Tags: #kate, #frameworks Differential Revision: https://phabricator.kde.org/D15196 M +3 -0 autotests/folding/test.py.fold M +1 -1 autotests/html/test.coffee.html M +3 -0 autotests/html/test.py.html M +3 -0 autotests/input/test.py M +1 -1 autotests/reference/test.coffee.ref M +3 -0 autotests/reference/test.py.ref M +0 -3 src/lib/rule.cpp https://commits.kde.org/syntax-highlighting/2475bc4dd2ca94eaaaa4ab98a695d89ac200f5c4 |
See attached screenshot. Python fragment: def asdfasdf: asdfasdfa asdfasdf #FIXME ### NOTE #NOTE #NOTE def asdfasd adf sad