Closed rejmann closed 3 months ago
I'm unable to reproduce the error using the steps provided. Is there any further info you can provide to help debug this?
Sorry for the delay @bmewburn, I ended up not seeing the notification of this issue!
Below is a quick video demonstrating the bug found, it is worth noting that the new directory is created as stated and the old one is left without the created class.
Hugs.
Thanks @rejmann , can you also post the autoload section of your composer.json for this example if there is one?
For sure @bmewburn! I only ran composer init and nothing else.
{
"name": "php/test",
"description": "test intelephense",
"autoload": {
"psr-4": {
"Php\\Test\\": "src/"
}
},
"authors": [
{
"name": "rejman"
}
],
"require": {}
}
Some update here?
I still cant reproduce the original issue of incorrect directories being created. To me this seems more like a feature request to delete empty directories after a rename.
Oops @bmewburn , I ended up noticing that there really wasn't a problem in the video. My apologies!
But we identified that, if composer.json has a namespace without the slash at the end of the directory:
Slash added at the end of "src"
"psr-4": {
- "App\\": "src",
"App\\": "src/"
}
It concatenates App with the first subdirectory creating a namespace App\SubdirectoryName...
Perhaps making a regex to consider the slash at the end if it is not specified should help resolve the bug.
yep
If we have a class with its namespace
"Intelephense\VsCode\Rename\Test"
than its respective directory"src/Intelephense/VsCode/Rename/Test"
and when renaming it to a new namespace called"Intelephense\VsCode\Rename\Test\NewNamespace"
a new directory is being created with the first backslash"src/IntelephenseVsCode/Rename/Test/NewNamespace"
escaping, meaning Intelephense and VsCode are concatenated.To reproduce, simply rename a namespace in your project and look at its first directory.
A new directory must not be created by concatenating the beginning of the namespaces
v1.10.2 (premium) Windows 11 + WSL Ubuntu 22.04 LTS e Pop!_OS 22.04 LTS