Yes, spot on: add all namespaces that needs to be imported. :)

    alright, I get it. Something like "apply all recommended fixes", or "import all namespaces"

      7 months later

      Hi,

      I realized what isn't so good about ctrl+.

      Even though there is only 1 class with the name, I have to activate the quick actions, read the options, and select the one that I want.

      In contrast, PHP Namespace Resolver just adds it without asking. It only asks when there are multiple classes with the same name.

      Thank you.

      Yea, but the automatic adding doesn't always work, especially when there are typing mistakes or editing of the names etc.

        8 months later

        JakubMisek

        is it possible to expose a command that I can call to resolve the namespace of the class that the cursor is on?
        Today, I'm using the shortcut key ctrl + alt + i to "force" it.

        The issue is that there are frequently classes of the same name, I need to select the correct one.
        This plugin does it quite well https://open-vsx.org/extension/MehediDracula/php-namespace-resolver

        I suspect this feature requires a language server, so I prefer to just rely on yours. Thank you.

          JakubMisek

          I did and tried for quite a whlie already. For instance in my project, Router class has 3 possibilities:

          use Illuminate\Routing\Router;
          use Google\Service\Compute\Router;
          use Symfony\Component\Routing\Router;

          But Quick Fix... showed No code actions available

          See the difference in the 2 videos: https://imgur.com/a/Ggh0yqs

            phptools I see, there is no Quick Fix, because there is nothing to fix. The Router is a perfectly valid name in this context.

            So you'd like to use a different Router. We don't have a "quick fix" like that, but I'll note it in our to-do to add some refactorings for this. It's a good idea!

            JakubMisek

            Thanks! If you could, perhaps make selection the same style like finding files/workspaces instead of a pop up :)

              11 days later

              JakubMisek I'm "patiently" waiting for this feature. Thank you! :)

                a month later
                24 days later

                phptools implemented 😄

                will be available in the next pre-release.

                  thanks can share which version so I can test? Thank you.

                    2 months later

                    I'm on 1.33, how do I test this? Don't see any new commands with "namespace" in them.

                      5 days later

                      JakubMisek

                      Pressing ctrl + . while my cusor was on Request had no effect for me, nothing pops up.
                      Can we define our own keyboard shortcut?

                      (And I can't seem to attach images here... ctrl+v doesn't convert into a URL like normal and it brings me back to the previous conversation on this forum)