Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't rename symbol in a file published from a Composer package #3101

Open
qbuache opened this issue Oct 24, 2024 · 2 comments
Open

Can't rename symbol in a file published from a Composer package #3101

qbuache opened this issue Oct 24, 2024 · 2 comments
Labels

Comments

@qbuache
Copy link

qbuache commented Oct 24, 2024

Describe the bug

Using VScode, If I publish a file from a Composer package to some destination, for example vendor/my_package/src/Trait.php => app/Traits/Trait.php, then I can't rename symbols in the published file (app/Traits/Trait.php).

Error in VSCode output is

Request textDocument/rename failed.
  Message: Rename failed. Symbol is defined in stub or excluded files.
  Code: 102

This is linked to the configuration Intelephense › Rename: Exclude => **/vendor/**

Without that configuration the symbol is renamed in both the published and vendor files.

To Reproduce

  1. Publish a file from a Composer package
$this->publishes([
        __DIR__.  '/src/Trait.php' => app_path('Trait.php'),
]);
  1. Press F2 on a symbol in the published file and rename it

Expected behavior

The symbols in the published file should be renamable, while respecting the Rename: Exclude rule, thus without impacting the file in /vendor.

Platform and version
macOS Sonoma 14.6.1 and Intelephense v1.12.6

Best regards

@Eptagone
Copy link

Eptagone commented Nov 9, 2024

I have the same issue. I'm working in a lib, so, I installed the lib from my local using composer and this one created a symbol link.

- libs/my-lib <- I'm trying to rename a class from here but that error occurs
- src
- vender/my-lib <- Symbol link
- composer.json

@b4zs
Copy link

b4zs commented Jan 3, 2025

I dont think that it is the responsibility of the language server to determine custom project structures. The problem can be solved by adding you package path to intelephense.rename.exclude globs with negation pattern, eg !**/vendor/my-lib/**, at least in my case it helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants