Closed tomilho closed 2 weeks ago
I changed the diff algorithm, lmk what you think.
Thanks for the PR, looks super cool! I'll give this a look this week.
You're right in that there's no "proper" support for custom diff editors in VS Code. That's something I would like to get done in the future, but this is a nice start and should be reusable if/when support arrives.
This is really neat. I've added it to my review queue when I get some free time.
cc @mjbvz if you have any feedback on the best way to do custom editor diffs since it's not very common there are not many examples of this
also, regarding diff algorithms, I wonder if we can use existing implementations. I'm sure there are good libraries out there, though maybe ones that would need to be compiled to wasm. Doesn't need to happen in this PR.
Thank you for the comments!! I will for sure look into some libraries since I am not happy at all with my latest version (comparing 2MB files results in a crash). But please don't feel pressured to prioritize this as it is a WIP.
Regarding diff algorithms, I really liked the wfa2-lib diff used in biodiff. However, it does not work properly in wasm32 as it is coded to work for 64bit but since wasm64 is right around the corner, I think we can use diff in the meantime. And when wasm64 is released, I can bring wfa2 into the project.
Let me know if this is okay with you.
Another thing we could do is make the hex editor a platform-specific extension and ship binaries that are subprocessed into on supported platforms (64 bit platforms minus web, presumably.) This is not super hard to do from an engineering perspective since Python recently paved the way with its native locator. I can try and carve out some time next iteration to get that in if you think it makes sense :)
We could use the JS diff library on platforms where that's not supported. We may want to do that on a worker_thread though to avoid blocking the extension host on very large diffs.
If you want to get that going in this PR I can follow up next month with a wfa2/biodiff version.
I had no idea vscode extensions could ship with binaries! I really like the idea to be honest, especially when wasm64 may still take some time even though there is only one task left. I will start with the JS diff and worker_thread. Let me know if I can help you with the wfa2 stuff.
I've added the worker and the JS Diff. I did the worker such that it only works when running web vscode, but I wasn't entirely sure how to structure it, see these lines.
You can also do it in Node.js using the worker_threads module which implements a very similar interface to the webworker :)
Cool, thanks! I'll give this a more thorough review soon.
I also put in an issue for biodiff for avenues we could explore to leverage it here: https://github.com/8051Enthusiast/biodiff/issues/20
Thank you! Let me know how I can help
Thank you for the review and sorry for the late changes.
Thank you for the opportunity to work on this and taking your time to review everything! I learnt so much about diffing and vscode.
MVP to receive some early feedback on the diff process. (Closes #47 )
As I was unsure if it was possible to do this since there isn't any explicit API to create custom diff, I rushed most components to figure out the diff process. There is still plenty of work to do, but hopefully this shows how the diff can look.
Simple Diff Algorithm
Improved Diff Alg
There are some issues due to VSCode not supporting custom diff editors (I think), below is a list.
(Unfixable?) Issues
vscode.window.TabGroup
does not have a class type for custom editor's diff, so.input
is undefined.Insert
does not work