You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried implementing the other completion, and it was going rather well, until I discovered that the PSR0 loader doesn't quite live up to the spec: http://www.php-fig.org/psr/psr-0/
It's only in class names that the underscores can be used as separator, so the original test that checks if Psr0Ns_T to Psr0Ns_TheClass is wrong. I then carried that misunderstanding on in the subdir handling.
Trying to fix that up gave me all kind of troubles, so before carrying on, I'd like to ask how important underscore completion is? Or could we get away with just always completing with backslashes? I mean, following the specs, Psr0Ns\TheS should offer both Psr0Ns\TheSubdir_ and Psr0Ns\TheSubdir\ as possible completions, and that's, IMHO, just ugly. And if you're using PSR4, backslashes should work just fine.
Ah, that's true. We can open another issue on that, but I think the impact is pretty limited because:
PSR-0 is deprecated
Most of the time, you use either namespaces or big class names, so there is not that much risk of mixing stuffs. At least that's my experience
Well, that's where I don't quite follow. I remember the big class names of yore and figured PSR0 tries to retain some compatibility with that, but according to the spec they still need to be prefixed by the vendor namespace.
So the file Dir/Sub_Dir/Class.php can be used as Vendor\Dir\Sub_Dir\Class or Vendor\Dir_Sub_Dir_Class or Vendor\Dir_Sub_Dir\Class or Vendor\Dir\Sub_Dir_Class, but not Vendor\Dir\Sub\Dir\Class or Vendor_Dir_Sub_Dir_Class.
Are you seeing different rules in the wild?
Whatever the case, it needs to match up with the classname actually used in the PHP file, but we can't read that.
In order to live up to the spec, as I see it, completion should simply offer subdirs as both SubDir\ and Subdir_, in order for PSR0 completion being able to provide whatever the user wants to use, and drop any other attempts at guessing. Though it will properly increase the number of completion steps (pressing tab, whatever) for the user, as each directory will basically appear twice. And leave it up to the developer to choose the one used in the PHP file.
Agree?
The text was updated successfully, but these errors were encountered:
I agree that we have to propose directories with either '\' or '_'. So yeah, it's more annoying for the developer, but it's because of PSR-0, not because of us, so I have no problem with it.
Carrying over from #27 where I wrote:
And @stevenremot wrote:
Well, that's where I don't quite follow. I remember the big class names of yore and figured PSR0 tries to retain some compatibility with that, but according to the spec they still need to be prefixed by the vendor namespace.
So the file
Dir/Sub_Dir/Class.php
can be used asVendor\Dir\Sub_Dir\Class
orVendor\Dir_Sub_Dir_Class
orVendor\Dir_Sub_Dir\Class
orVendor\Dir\Sub_Dir_Class
, but notVendor\Dir\Sub\Dir\Class
orVendor_Dir_Sub_Dir_Class
.Are you seeing different rules in the wild?
Whatever the case, it needs to match up with the classname actually used in the PHP file, but we can't read that.
In order to live up to the spec, as I see it, completion should simply offer subdirs as both
SubDir\
andSubdir_
, in order for PSR0 completion being able to provide whatever the user wants to use, and drop any other attempts at guessing. Though it will properly increase the number of completion steps (pressing tab, whatever) for the user, as each directory will basically appear twice. And leave it up to the developer to choose the one used in the PHP file.Agree?
The text was updated successfully, but these errors were encountered: