iamhyc / Overleaf-Workshop

Open Overleaf/ShareLaTex projects in vscode, with full collaboration support.
https://marketplace.visualstudio.com/items?itemName=iamhyc.overleaf-workshop
GNU Affero General Public License v3.0
507 stars 11 forks source link

Syncing Renamed Files #183

Open sleepymalc opened 2 months ago

sleepymalc commented 2 months ago

Describe the bug

A clear and concise description of what the bug is.

When renaming a file on Overleaf and reopening the local repo, the syncing will only create new files with the new name, but will not remove the local files with the old names.

Expected behavior

A clear and concise description of what you expected to happen.

Renaming should be executed appropriately on the local side as well when syncing.

How To Reproduce

Detailed steps to reproduce the behavior.

As described.

Environment

iamhyc commented 2 months ago

When renaming a file on Overleaf and reopening the local repo, the syncing will only create new files with the new name

The sync will not remove the local existing files.

Rename is just to delete an old file and create a new file, so the old file still exists after the sync.

sleepymalc commented 2 months ago

If a file is removed from the server, I think it should also be removed from the local?

iamhyc commented 2 months ago

If a file is removed from the server, I think it should also be removed from the local?

"remove" is an "action", "sync" only sync the "status".

sleepymalc commented 2 months ago

it's not really meaningful to argue what does "sync" mean literally here. The expected behavior is something more important I think. In any case, I'll expect that when I change the name of the file, the same thing should be done in my local repo, not leaving files with old name waiting to be removed manually.

iamhyc commented 2 months ago

it's not really meaningful to argue what does "sync" mean literally here. The expected behavior is something more important I think. In any case, I'll expect that when I change the name of the file, the same thing should be done in my local repo, not leaving files with old name waiting to be removed manually.

think twice. I am not argue with you about "rename files" but why the "delete" is ignored.

sleepymalc commented 2 months ago

This is more like an unexpected behavior. If we're regarding delete as an action, then actually creat is also an action. So if sync indeed creates a new file in the local repo, it's expected that the old file will also be deleted by sync.

iamhyc commented 2 months ago

This is more like an unexpected behavior. If we're regarding delete as an action, then actually creat is also an action. So if sync indeed creates a new file in the local repo, it's expected that the old file will also be deleted by sync.

Exactly. But the fact is that, "sync will not remove the local existing files". It currently only creates/overwrites files, because "delete" may cause more severe unexpected behavior.

The root cause is that, local folder does not have version control! Every time you open the folder in vscode, it has to keep up with the "status", the status of the web server. As you said, non-existing files on server should be also deleted locally. But what if I have temporary files before? Or some files create locally not synced to the server? I cannot simply delete them.

I agree that the behavior should be fixed. The problem here is how to sync (or merge) the status between the local and the server.

sleepymalc commented 2 months ago

I think the expected behavior is that, if there's a tmp file the user wants to ignore and not sync to the server, then it should be added via the ignoring list (or pattern). Everything not matched by the ignoring list should be sync exactly. At least this is the expected behavior for me. Not sure whether this will cause other issues that I'm not aware of tho.

iamhyc commented 2 months ago

I think the expected behavior is that, if there's a tmp file the user wants to ignore and not sync to the server, then it should be added via the ignoring list (or pattern). Everything not matched by the ignoring list should be sync exactly. At least this is the expected behavior for me. Not sure whether this will cause other issues that I'm not aware of tho.

That is tricky. I would prefer merge the changes, but of course, it will create two files in the "rename file" case.

I may finally need to add a version control for the local folder. Before that, I don't want to delete any files. If the current behavior bothers you, you can try to delete the whole local folder, except for the ".overleaf" folder, every time before opening it in vscode.

I will post any progress on the version control thing in another issue #180 .