Open sanderkob opened 1 year ago
Thanks for the feature suggestion.
I think a generic edit mode is probably out of scope for now. The VS Code API is tailored for some very specific use cases and is often limited in other areas. We ran into such limitations when we tried to add our own diff mode. We couldn't change the way the existing diff viewer worked and had to write one from scratch using the webview functionality. The same thing happened when we tried to add syntax highlighting to the displayed code. The VS Code API didn't provide a way to access the syntax highlighter and we had to reimplement it (albeit by reusing a lot of VS Code's code). I think reinventing the editor as well would probably take too much time away from improving the core functionality of SemanticDiff.
But that doesn't mean we can't add something more basic. To evaluate this, it would be good to understand your needs a little better:
The way I use SemanticDiff now is:
Since most changes are simply moves between the versions, that would be the most important feature. Bonus would be the ability to delete the block or insert it instead of move it, see Meld for the details. The detailed editing is something I would still do later in a proper editor. I am not certain what style changes are. But i do not think that is important for me.
By style changes, I mean a situation like this:
Line 3 in the old code corresponds to line 3-7 in the new code. The only change that is considered relevant by SemanticDiff is the addition of the new parameter in line 6, everything else is considered a style variation. I wonder how a copy button should behave in such a situation. I can think of two ways:
a) SemanticDiff would copy the whole block and thus replace line 3 (old) with the lines 3-7 (new): Result:
func test(
param1 int,
param2 float64,
param3 byte,
) int {
b) SemanticDiff would try to copy the invidual change and merge it into the old style:
func test(param1 int, param2 float64, param3 byte) int {
Which solution (a, b, something else) would you prefer?
I am for solution a, personally I am in favour of implicit line continuation anyway. And solution a is in line with what SemanticDiff tries to offer: make code more readable when comparing.
The Diff viewer works fine, but does not allow to edit text or move text segments from one file to the other in the diff viewer.
A behaviour such is in Meld (meldmerge.org) would be very helpfull.