Open leeavital opened 2 weeks ago
jj config edit --user
quits with a message like "could not save, invalid toml"
Just to be clear, it probably means jj config edit
will create a temporary copy for editing, and copy it back at end.
Good point. I don't know if users expect changes to the file to take effect immediately. If we think they do, we could create the temporary copy for backup instead.
Most programs that I can think of open the real config file when you use some sort of an "edit configuration" command. Kitty terminal and VS Code come to mind. As Martin pointed out, I do expect being able to save the config file in one tab and immediately test it out in another tab.
VS Code seems to have some logic to use a last known OK config (I think?) if the syntax of the config file is broken. I wonder what they do exactly.
I also wonder whether it's ever dangerous to run jj
with an unexpected config. If not, perhaps either storing a last known good config, or a last known minimal good config (e.g. just the user name and email) might be worth it.
Update: If we go into the direction of "minimal good config", it might make sense to simply store those "minimal" options in a separate config file that jj config edit
does not touch.
OTOH, it would be nice if jj config set
was a "safe" interface that never broke the config file syntax and perhaps even warned the user about semantic errors. I think it's a good distance on the way there.
I took a crack at the 'temporary file solution' in https://github.com/martinvonz/jj/pull/3945
Description
Steps to Reproduce the Problem
jj config edit --user
Note the lack of quotes around
vim
Expected Behavior
jj config edit --user
quits with a message like "could not save, invalid toml"Actual Behavior
Any
jj
command (includingjj config edit --user
) fails with:Until you fix the problem.
Specifications