composer icon indicating copy to clipboard operation
composer copied to clipboard

Tabs in `composer.lock` if `composer.json` indented using tabs

Open maximal opened this issue 3 years ago • 4 comments

I like the way NPM handles lock files indentation: if package.json uses tabs then package-lock.json also will be indented using tabs, if the former has spaces then the latter will have spaces.

Maybe it would be semantically correct to implement the similar behavior in Composer, so that composer.lock was indented the way composer.json is.

Also, this issue is linked to #3192

maximal avatar Feb 18 '23 16:02 maximal

Yeah I guess we could do that, sounds reasonable although a little work for not much value IMO as the lock file should not really be opened/edited.

Seldaek avatar Mar 20 '23 19:03 Seldaek

I also think the composer.json file itself, as outlined in the linked ticket, should be the prio here.

dereuromark avatar Mar 21 '23 01:03 dereuromark

@Seldaek, at least users using tabs will have much smaller composer.lock :-)

I guess, I could do this, I only need to find where the JSON files generation is located.

maximal avatar Mar 21 '23 09:03 maximal

I taught JsonFile to preserve indentation when writing files. See #11390. Maybe this behavior will be enough. Can you check the pull request please?

So, it is sufficient to once reformat composer.lock using tabs and then Composer will be preserving tabs in it.

This is not what I originally wanted (in this issue specifically), but at least something to move on. I don’t know yet how to pass composer.json indentation to Locker instance.

maximal avatar Mar 21 '23 16:03 maximal