ta-tikoma / php.easy.nvim

Helperfor simplify work with PHP - projects
16 stars 2 forks source link

PSR-4 does not work with different composer.json indenting / layout #1

Open jorismak opened 4 months ago

jorismak commented 4 months ago

When trying out the init functions (which I miss the most from other environments), I noticed the initial namespace was wrong. (src used for the directory instead of App as in composer.json).

When diving in the source, I'm happy to see there is actually a bit of PSR-4 support for this!

But... it matches the psr-4 lines literally, including spaces.

My composer.json is indented differently (and I didn't touch it up manually or something).

Is it possible to use a regex for this to ignore the amount of whitespace on a line? (Me not knowing anything about lua).

ta-tikoma commented 4 months ago

Hi, @jorismak Please, send example from your composer.json for debug.

jorismak commented 4 months ago

Attached.

I also forked your repo and started hacking, but for me, it was a learning experience in Lua :).

I used a JSON parser to get to the psr-4 block and left the rest to your code. (And I removed the final keyword from the class, but that's just my preference). https://github.com/jorismak/php.easy.nvim/blob/main/lua/php-easy-nvim/any/entities/object.lua#L19

ta-tikoma commented 4 months ago

you can make pull request, if you want