D25587: [KDevelop/PHP] fix rename of a variable

Hugues Mitonneau noreply at phabricator.kde.org
Thu Nov 28 10:29:03 GMT 2019


hmitonneau created this revision.
hmitonneau added a project: KDevelop.
Herald added a subscriber: kdevelop-devel.
hmitonneau requested review of this revision.

REVISION SUMMARY
  Renaming a variable doesn't work.
  This is because in `KDevelop::DocumentChangeSetPrivate::generateNewText`, `rangeText(change.m_range, textLines)` return the value `$oldname` and `change.m_oldText` has the value `oldname`
  
  This patch modify the parser to remove the "$" in the range of variable identifiers. As a result, we can now rename a variable, but as a side effect, the "$" is no more highlighted with the variable (the "$" are always blue, and do not take color of the variable)
  
  F7788333: Screenshot_20191128_110431.png <https://phabricator.kde.org/F7788333>
  
  F7788334: Screenshot_20191128_110516.png <https://phabricator.kde.org/F7788334>
  
  F7788335: Screenshot_20191128_110534.png <https://phabricator.kde.org/F7788335>

TEST PLAN
  Right-click on a variable
  Select "Rename xxx..."
  Choose a new name and click "Rename"
  
  All the occurrences of the variable must be renamed

REPOSITORY
  R52 KDevelop: PHP Support

REVISION DETAIL
  https://phabricator.kde.org/D25587

AFFECTED FILES
  duchain/builders/contextbuilder.cpp
  duchain/tests/duchain.cpp
  duchain/tests/duchain_multiplefiles.cpp
  duchain/tests/uses.cpp

To: hmitonneau
Cc: kdevelop-devel, hmitonneau, christiant, glebaccon, domson, antismap, iodelay, alexeymin, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20191128/15b8b7bd/attachment.html>


More information about the KDevelop-devel mailing list