[Differential] [Request, 81 lines] D3437: Make the hack for finding attribute ranges more robust.
flherne (Francis Herne)
noreply at phabricator.kde.org
Mon Nov 21 17:59:10 UTC 2016
flherne created this revision.
flherne added a reviewer: brauch.
flherne set the repository for this revision to rKDEVPYTHON KDev-python.
Restricted Application added a subscriber: kdevelop-devel.
REVISION SUMMARY
Previously, this would find an incorrect range if the attribute was immediately followed by a comment containing its name.
e.g. `foo.bar #bar` would highlight the comment.
This patch ensures that we ignore comments in all cases.
Unfortunately, this introduces a new (much less likely) failure case.
If the expression we're getting the attribute from contains a dot, the name of the attribute and a hash in that order (not necessarily consecutive), and the hash is on the same line as the attribute name, we wrongly interpret the hash as the start of a comment.
For example, `foo["...barrier#"].bar` will highlight part of the string.
This should be very unlikely to occur in practice.
TEST PLAN
No regressions in pre-existing tests.
Added three new tests, two fail->pass with this patch and one pass->fail as described above.
Much staring at mis-highlighted bits of code.
Seriously, this whole problem is just stupid.
REPOSITORY
rKDEVPYTHON KDev-python
REVISION DETAIL
https://phabricator.kde.org/D3437
AFFECTED FILES
duchain/tests/pyduchaintest.cpp
parser/astbuilder.cpp
EMAIL PREFERENCES
https://phabricator.kde.org/settings/panel/emailpreferences/
To: flherne, brauch
Cc: kdevelop-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20161121/6be3f42b/attachment.html>
More information about the KDevelop-devel
mailing list