-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detecting moves in the diff editor #181902
Comments
I’m working in this problem too, although my approach is rather a 180 from myers algorithm and character by character diffing. Here is my work, still very WIP |
@ElianCordoba thanks so much for reaching out! However, I'd like to explore the idea of allowing extensions to contribute (better/language-specific) diff algorithms. I'll try to come up with some API ideas how extension contributed diff computers could look in the next couple of days. Our default diff algorithm implementation initially will only support detecting very simple and straight forward moves that don't have additional changes. For now, the challenge of this issue is the UX. |
Hi @hediet, thank you for taking the time to look at my work. I'm keen to contribute! I believe there is significant room for improvement in the field of text diffing. Here are a few quick thoughts. I wanted my tool to be integrated within VSCode so you could check the diff without leaving the editor. There were two ways to do this, but neither convinced me:
My tool produces an array of changes, which are objects that holds the necessary infomation to, along side with the sources, render the change. These are a When rendering, I take the original source code and locate the ranges to highlight them – additions in green, deletions in red. Moves affect both sources, which I color in blue. While attempting to implement the move UX with the current API, I encountered a blocker, I couldn't figure out how to create a custom hoverable range, this was what I was trying to archive: For these two ranges, my plan was to color them in blue and, when any of these are hovered over, find the corresponding code with the same ID (on the opposite side) and highlight that too. Brief note on move UXI realized that displaying code movements required some effort to make it clear where the code had moved. If the code only moved to the line below, it would be easy to spot because it would be immediately visible. However, if the code moved to the bottom of the file, you would need a way to link the before and after, and this becomes even more crucial when multiple moves are involved. This is the website of that project |
This feature is now available in the latest stable. set See #187432 for the remaining tasks. |
No description provided.
The text was updated successfully, but these errors were encountered: