I use VSCODE to write the php code.
I'm going to rename a variable or function.
Many sites say "Press F2", but
When I actually press F2, there is no response.
The variable has a cursor and the variable is selected, all of which are unresponsive.
Click Ctrl-F2 to change the string.
It is not available because it ignores the scope and changes all characters.
function sample1(){
$result=1;//<=Change this
return$resutl;
}
function sample2(){
$ResultSample=2;
return$ResultSample;
}
/// If resetl is hoho, the following occurs:
function sample1(){
$hogehoge=1;
return $hogehoge;
}
function sample2(){
$hogehogeSample=2;
return $hogehogeSample;
}
By the way, when editing vue, you can change the name of the in-scope variable with the "f2 key when the variable has a cursor (not selected)."
There seems to be some configuration, but I couldn't find it in the search engine.
Is there anything that needs to be expanded?
Thank you for your cooperation.
In VS Code, F2 should have editor.action.rename
assigned
When using php, another command may be enabled by specifying when
(You may find it by referring to the keyboard shortcut (Ctrl+kCtrl+s).
If you want to run editor.action.rename
, open the command palette (Ctrl+Shift+p) and copy the command ID
Alternatively,
editor.action.rename
to another key
© 2025 OneMinuteCode. All rights reserved.