zed icon indicating copy to clipboard operation
zed copied to clipboard

Newline between variables in list

Open dy opened this issue 1 year ago • 5 comments

Check for existing issues

  • [X] Completed

Describe the feature

let a, b, c; // I want this
let a,
    b,
    c; // zed does this

Is there a way to configure that?

If applicable, add mockups / screenshots to help present your vision of the feature

No response

dy avatar Feb 21 '24 20:02 dy

What language is that, JS? Zed does not do anything to formatting itself, instead passing that onto prettier or the language server, depending on your set-up: check out formatter in your settings and, if there's nothing, in the default settings json to see the configuration options. Refer to https://github.com/zed-industries/zed/discussions/7951#discussioncomment-8501391 for more explanation.

SomeoneToIgnore avatar Feb 21 '24 21:02 SomeoneToIgnore

I don't see that behavior with default prettier, that's the thing: https://prettier.io/playground/

Also btw have you considered biome as default js formatter?

dy avatar Feb 23 '24 00:02 dy

So, JS after all?

I know that Prettier default formatting logic had been different between versions, might be that the playground has something different in that regards. If it's not prettier, then maybe it's a language server formatting? The "formatter" section in the settings should tell us more.

Another thing that can help debugging is an debug: open language server logs command that shows Prettier logs with all plugins and effective settings, if that file is indeed being formatted with it: image

Biome had been proposed in https://github.com/zed-industries/zed/issues/4402 but that's all progress on that field so far.

SomeoneToIgnore avatar Feb 23 '24 06:02 SomeoneToIgnore

It's JS, yes. What's the way to disable it at least? That pretty enforcement is really annoying - it reformatted a bunch of files across project I had to revert manually.

I am sorry for not being helpful here, I really struggle finding time for my own projects, cannot take on debugging... I just think enforcing someone's opinion about formatting without easy way to disable / change it is maybe not very liberal.

dy avatar Mar 02 '24 19:03 dy

Sure, you can try setting the formatter option to something else, e.g. language_server or set the "format_on_save": "off",

SomeoneToIgnore avatar Mar 02 '24 19:03 SomeoneToIgnore