Description
Word of appreciation
First off, wonderful work. Thank you. This is not a request specific to this library, I have not found any LSP or IDE (even PHPStorm) that implements this feature.
Enhancement Request
When using autocomplete, say for a class called RuntimeException I would love candidates to be prioritised like so:
- Classes within your own code, i.e.
MyLibrary\Exceptions\RuntimeException
core/php types, in this case \RuntimeException
- 3rd party libraries, explicitly required in
composer.json
It should never offer candidates from libraries that you don't explicitly depend on.
Use case
When working on my own library:
- I begin typing
throw new \RuntimeE and then request autocompletion.
- The first candidate is
Symfony\Component\Yaml\Exception\RuntimeException
- I have not listed
symfony/yaml as a dependency, it is required, indirectly by another dependency. I should never see this offered.
This has two benefits:
- It offers candidates that are more likely to be what users want
- It promotes good practice:
a. "Why isn't Symfony\Component\Yaml completing?"
b. "Have you listed it in your dependencies?"
c. "No"
d. "If you're using it, then you depend on it. List it in your dependencies and it will work."
Proposed solution
^ See description
Alternatives considered
I could filter candidates locally, but that would be editor-specific and I'd have to duplicate PHP-aware code to do so.
Code example
Type in throw new \Runtim on any project where vendor/ contains a custom runtime exception that you don't explicitly depend on.
Description
Word of appreciation
First off, wonderful work. Thank you. This is not a request specific to this library, I have not found any LSP or IDE (even PHPStorm) that implements this feature.
Enhancement Request
When using autocomplete, say for a class called
RuntimeExceptionI would love candidates to be prioritised like so:MyLibrary\Exceptions\RuntimeExceptioncore/phptypes, in this case\RuntimeExceptioncomposer.jsonIt should never offer candidates from libraries that you don't explicitly depend on.
Use case
When working on my own library:
throw new \RuntimeEand then request autocompletion.Symfony\Component\Yaml\Exception\RuntimeExceptionsymfony/yamlas a dependency, it is required, indirectly by another dependency. I should never see this offered.This has two benefits:
a. "Why isn't
Symfony\Component\Yamlcompleting?"b. "Have you listed it in your dependencies?"
c. "No"
d. "If you're using it, then you depend on it. List it in your dependencies and it will work."
Proposed solution
^ See description
Alternatives considered
I could filter candidates locally, but that would be editor-specific and I'd have to duplicate PHP-aware code to do so.
Code example
Type in
throw new \Runtimon any project wherevendor/contains a custom runtime exception that you don't explicitly depend on.