tamasfe / taplo

A TOML toolkit written in Rust
https://taplo.tamasfe.dev
MIT License
1.44k stars 114 forks source link

VSCode extension formatting options require reloading #687

Open ShaiAvr opened 4 weeks ago

ShaiAvr commented 4 weeks ago

I am trying to edit my pyproject.toml file, and I am playing with the extension's formatting options, but I have a weird issue. The formatting options don't apply until I restart or reload the editor.

For example, in my settings.json file I have "evenBetterToml.formatter.allowedBlankLines": 1 which works as expected: if I have more than one blank line, they're collapsed into a single blank line when I save or format pyproject.toml. However, now I change the setting to 3 and add some blank lines. When I save the file, the blank lines are again collapsed into a single blank line instead of 3. When I reload the editor (Developer: Reload Window) or restarts it, then the new setting applies and multiple blank lines collapse to 3 blank lines.

This happens with any time I change the formatting options. The old options still apply when I save or format the file, and only after reloading or restarting the editor, the new settings apply.

I think this is a bug, and if it's not, then it should still be changed. It's very frustrating to reload the editor every time I want to change the formatting options.

estyrke commented 4 weeks ago

It's the language server that needs to be restarted. Many extensions provide a command for this, but this extension does not (e.g. TOML: Restart Server). The extension could also try to detect when the server needs to be restarted, but that's probably trickier.

I'd not say it's a bug per se, more of a missing feature. And I agree it's frustrating.