phptools I see!
I agree. A command would make more sense in this case, and in case of anyone having so many classes.
phptools I see!
I agree. A command would make more sense in this case, and in case of anyone having so many classes.
I think https://marketplace.visualstudio.com/items?itemName=MehediDracula.php-namespace-resolver got the UI just right, do check them out.
But it is very slow compared the PHP Tools :)
phptools That would make more sense in case of more options, thank you for the tip!
We've implemented "Import class ..." command (id: "phptools.importClass"
). As suggested above, it gets a list of possible fixes as a drop-down quick-pick:
The feature is available in the latest pre-release.
I'm wondering if it would be useful to implement any other import commands?
JakubMisek hi thanks
phptools.importClass
works for me! Thank you!2 suggestions:
If my code is \Illuminate\Support\Facades\App::blah(...)
and I run phptools.importClass
, it should still show me a list based on App
because I might have selected a wrong namespace previously. Currently, a No classes found
toast appears instead of the UI, I suppose it is because it cannot find alternatives to \Illuminate\Support\Facades\App
.
Separate inline Illuminate\Support\Facades\App
and use Illuminate\Support\Facades\App
into 2 commands or make it configurable not to show the inline one. The cognitive load required to pick from a long list is quite significant and for readability, we seldom inline classnames. I usually see inline classnames only when there is a clash. Offhand, I'm thinking ctrl + alt + i
for use
, ctrl + alt + shift + i
for inline. The command name can be phptools.inlineClass
haha
phptools no idea, it's a bug, will be fixed :) thank you
phptools other import commands like \App
and use App
.
phptools the idea was to start typing a few letters (i.e. us Fac
), so the long list gets filtered. But I see the point.
Can't speak for the rest, but for Laravel where classes frequently have the same class name due to convention, normally I look for the line with the word Facade
and pick that. However, now I have to choose between 2 Facade
, inline
vs use
, that is what I meant by the cognitive load.
But I can see why it is a good idea, sometimes when we want to include traits (which starts with use
), Let me use it a bit more, but meanwhile, would be great if I can disable use
through a setting. 😉
Thank you!
phptools Makes sense, thank you for testing it! We'll be improving it over time.
I suppose I'm the only one testing it?
Possible to disable inline
for time being as it is harder to use than the one I was relying on before.
In other words, I would like only use XXXX
to show, i.e. it will insert under use XXXX
statements after namespace ...
Thank you.
phptools I'm not sure I understand this one:)
In the new quick pick command, there are both use ...
and FQN \...
, so it's easy to just hit a few letters and hit enter or arrow down and enter.
Ok, let me describe my current experience with the other plugin
use ...
is imported silently, I can tell it was imported because the wavy line under the class name disappears (ctrl + alt + i
, 0 cognitive load)facade
. the list is very easy on human eyes because they are consistent (ctrl + alt + i
+ up/down/enter, small cognitive load)With PHPTools
use
, even lines have no use
(inline), and now, I have to think which additional keys to type to filter... and filtering doesn't help, because odd lines still have use
and even lines without (ctrl + alt + i
+ several other keys + up/down/enter, medium to heavy cognitive load)My suggestion is to split this into 2 commands, 1 to show list of classes with use
, 1 to show list of classes without use
(inline)
Perhaps another not so obvious point is,
When transferring code from another file, i.e. a cut and paste operation. I might have 0 idea what classes are being used. If I see a wavy line under a class, all I want is for the wavy lines to go away, so it becomes way harder to use if I'm expected to know what to type to filter the list.
@phptools Thank you, makes sense.
Thanks! Really looking to an update soon.
phptools done, I'll prepare pre-release within today.
There'll be a second command FQN class ..
. The duplicity items were also fixed. And when there is just one option, it's completed automatically without the quick-pick list.
Thanks! I don't see mixed lines now. But I also cannot find FQN class
. Actually I need to add use .....
at the top of code more haha