TheNouillet / symfony-vscode

Symfony extension for Visual Studio Code
MIT License
20 stars 23 forks source link

Add class path prefix #37

Closed st-schneider closed 5 years ago

st-schneider commented 5 years ago

In the composer.json there is an autoload config that makes it look like all classes have their root in the root folder when it actually is in src/ folder. This disables the jumping to the classes from the view. Either read such configs from the composer.json or add an option to add a prefix for class file resolution please.

st-schneider commented 5 years ago

Can you save the psr-0/4 from autoload as well and add it to the class resolution strategy? composerObj.autoload['psr-0'] composerObj.autoload['psr-4'] https://github.com/TheNouillet/symfony-vscode/blob/9f7318751c0cc2c74d0dfcc4bd8adbf68636740b/src/symfony/ComposerJSON.ts#L17

TheNouillet commented 5 years ago

Hello,

I'm having trouble understanding the problem. Right now, here how it works :

So the "PHP parsing" part of the extension doesn't rely on the composer.json file. That said, there is a bug which prevents the "Go to service definition" functionnality to work correctly, because of an issue with the cache system (services, routes, parameters and classes are cached, so that the next startup of your project on VSCode is faster). This bug will be fixed in the next release. For now, you can reindex PHP files with the Reindex PHP classes command to bypass the faulty cache system.

Please let me know if I misunderstood the problem.

st-schneider commented 5 years ago

You seem to be right, after reindexing the classes could be resolved. I had the problem the the class name was something like Something\Else but it was in the src folder so it would be something like /src/Something/Else but it would always state Something/Else could not be found, and I assumed that the psr thing would be the cause.

st-schneider commented 5 years ago

I seem to still have that problem for some classes though

st-schneider commented 5 years ago

Does the extension also use the available exclude options from "files.exclude" option when indexing?