bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.57k stars 93 forks source link

Find all references within all workspaces #2241

Open AlexKratky opened 2 years ago

AlexKratky commented 2 years ago

Currently If I use function "Find All References" on a method, it will search within current workspace directory, but it will be helpful if this method could be used within other directories within Multi-root Workspace.

I have 4 projects, where the one (largest) have directory called "Shared", which, as the name says, shares code (services, models, etc.) across remaining 3 projects, so If I refactor some services in this directory and want to use Find All References, I must open the root directory as single project or use global search.

Workspace settings:

{
    "folders": [
        {
            "path": "..\\project1"
        },
        {
            "path": "..\\project2"
        },
        {
            "path": "..\\project3"
        },
        {
            "path": "..\\project4"
        }
    ],
    "settings": {
        "intelephense.environment.includePaths": ["../project1/shared/"]
    }
}
twoseascharlie commented 2 years ago

Agreed! I would also love it if it could work like this!

tianyiw2013 commented 2 years ago

1829

AlexKratky commented 2 years ago

@tianyiw2013 I don't think this is the same problem, I use includePaths settings, so if I write something in other project than project1, I get typehints for classes from /project1/shared/ directory, but If I click Find all reference on some class in shared directory, it will find references only for project1 folder

class TransactionService { public function placeTransaction(): void {} }


* /project2/app/Http/Controllers/ExapleController.php
```php
<?php
namespace  App\Http\Controllers;

use Project1\Shared\TransactionService;

class ExapleController {
    public function __construct(private TransactionService $transactionService) {}

    public function index() {
        $this->transactionService->placeTransaction();
    }
}

Typehints in ExapleController works great, but If I am in Project1\Shared and have open TransactionService and try to click on "Find All References" of placeTransaction method, It will not found anything.

coderfengyun commented 2 weeks ago

Any further news on this issue?