apache / incubator-kie-issues

Apache License 2.0
12 stars 1 forks source link

VS Code Extensions should keep their Editors in sync even when files change externally #119

Open tiagobento opened 1 year ago

tiagobento commented 1 year ago

When using VS Code, if you have any file, like my-dmn.dmn open, and you do a git pull that changes this file, the Editor does not update, basically ignoring the git pull you just did. That's just an example, any external change you make to files that are open in VS Code will not update them.

That's really bad, because if you make a change, you'll override what you just pulled.

The expected behavior is that the Editor will reload itself if its associated file changed externally, thus displaying the updated version of the file.

jomarko commented 1 year ago

@tiagobento what in case that git pull affects a dmn file, that is being edited, but contains not saved changes. Should be they lost by force or should a modal appear? I think the second one? If yes what should modal to offer to user:

Josephblt commented 6 months ago

Hello @tiagobento, @jomarko. There is a solution using VS Code API FileSystemWatcher implemented in the Extended Services VS Code Extension. We could replicate this for the other editors. I could move the solution to the base code vscode-extension and do only the necessary changes directly to the editors.

As for the conflict handling between file sources, there is no standard way. But, we could do something similar to this: https://code.visualstudio.com/assets/api/ux-guidelines/examples/notification.png It is just a matter of using a more appropriate message and accurate buttons. For example, instead of "Accept remote" - Accept local we go with Keep changes - Discard changes. Please let me know what you guys think.

jomarko commented 6 months ago

@Josephblt thank you for the link for the notification example. I think, yes, this can be an acceptable solution for the ticket. My only question is, will such notification appear:

Josephblt commented 6 months ago

Actually this should appear whenever there are differences between sources and VS Code has focus. Let's say for example, the user reverted changes to a repository using command line. When VS Code gets it's focus back, the popup appears.