`ui.merge-editor = "vscode"` auto-formats incorrectly.
Description
I'm not sure whether this is a vscode bug or a jj bug. When using vscode as a merge editor, once I save the merge, it autoformats my code. This is desirable, except that the auto format settings are not correct! My code is in Rust, and my rustfmt.toml sets tab_spaces = 2. This means after a merge, all my indentations expand to 4 wide (the default for Rust)!
Steps to Reproduce the Problem
- Set
ui.merge-editor = "vscode"in jj config. - Ensure vscode has "Format On Save" enabled.
- Create a Rust project (e.g.,
cargo new --lib test-proj) with a jj repo. - Create
rustfmt.tomlin the project root with the contentstab_spaces = 2 - Modify the Rust code and save it in VSCode to autoformat the code.
- Create a merge conflict (e.g., change the same line in two separate commits, then rebase one on top of the other).
- Run
jj resolve. - Fix the conflict and save and quit.
Expected Behavior
The code doesn't change it's formatting - it should still have two-spaces per indent, since that is what my rustfmt says. The parts that were merged are formatted to the project's settings.
Actual Behavior
The entire file gets completely reformatted to the default formatting - 4 spaces per indent.
Specifications
- Platform: Windows
- Version:
jj 0.32.0-44de571887f261a94f543d977a7ab3a9df918aba
Might be related to the "path" of the merge editor?
Typical oversight when generating temporary (code) files - if it is inside eg. /tmp, then project-level formatting settings would not get applied (at least when using formatters that read their own configs).
Typical oversight when generating temporary (code) files - if it is inside eg.
/tmp, then project-level formatting settings would not get applied (at least when using formatters that read their own configs).
yes, this is an accurate description. Related https://github.com/jj-vcs/jj/issues/6540