Bug 317879

Summary: "Rename ..." in PHP
Product: [Applications] kdevelop Reporter: Mister Ypsilon <mrypsilons>
Component: Language Support: PHPAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: wishlist CC: laurentiusilviu, mrypsilons
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 5.5.0

Description Mister Ypsilon 2013-04-05 12:32:59 UTC
In C++ code you can easily rename classes/attributes/methods in the whole project by right-clicking an occurrence of it and selecting "Rename <current name of class/attrib/method>". This feature is missing in the PHP plugin.
It would be very nice to have this feature in PHP, too.

Reproducible: Always
Comment 1 Kevin Funk 2017-04-07 08:58:54 UTC
Confirmed. Just doesn't work here. You actually get the 'Rename ...' popup, but after accepting it nothing happens.
Comment 2 Mister Ypsilon 2018-10-09 16:45:19 UTC
*** Bug 392833 has been marked as a duplicate of this bug. ***
Comment 3 Heinz Wiesinger 2019-12-28 09:24:59 UTC
Git commit f68154391a30139a8763c09fe1d103ab13565479 by Heinz Wiesinger, on behalf of Hugues Mitonneau.
Committed on 28/12/2019 at 09:24.
Pushed by wiesinger into branch 'master'.

Fix rename of a variable

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}

{F7788334}

{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
FIXED-IN: 5.5.0

Reviewers: pprkut

Reviewed By: pprkut

Subscribers: pprkut, kdevelop-devel

Tags: #kdevelop

Differential Revision: https://phabricator.kde.org/D25587

M  +98   -0    codegen/refactoring.cpp
M  +17   -0    codegen/refactoring.h

https://commits.kde.org/kdev-php/f68154391a30139a8763c09fe1d103ab13565479