robole/vscode-file-bunny

Enhancement Idea: After moving a file to a new folder, leave the focus in the source folder

ianmcgowan opened this issue · 2 comments

When deleting, this behaviour is an option:

"After the file is deleted, focus is switched to the next open file. This way you can carry on editing without needing to switch view to return to an active state. Other extensions don't do this!"

But after moving a file to another folder, focus moves to the target folder. When cleaning up a folder and moving lots of files around, it would be more efficient to leave the focus on the next file in the source folder.

I guess it's tricky to do, with a few edge cases - have to figure out the name of the file to return to, before the move happens, and what if that's the last file in a folder, or it's removed while the move is happening?

      // return focus to editor
      await vscode.window.showTextDocument(newUri);

But the delete active file does this instead:

      // give focus to next editor
      await vscode.commands.executeCommand("workbench.action.nextEditorInGroup");
robole commented

Hi @ianmcgowan

Thanks for you interest in the extension.

Is it the Move active file or Move file command you are referring to?

It is different with commands that work on active files. The issue I found, and that you quoted above, is that when you carry out a file operation in the background on a file that is open in an editor, then VS Code loses it place and you left in an essentially unfocused state. You need to click somewhere in the application to recover an active state somewhere.

I get the gist of what you are looking for. I am just wondering what it is you are doing that this will help you be more efficient at? Are you moving multiple files from one folder to another folder? Like a batch move of files?

I don't find myself moving many files in projects. I tend to reach for the command-line if I am moving more than a few files as it more precise and efficient.

When I have time, I will play around with the scenario in VS Code to see what makes sense. Other people may prefer to have it the way it is, they may like focus switching to the target folder! So, I am sure what the move is (excuse the pun).

Yes, it's kind of a niche requirement for "Move active file" - I sometimes have a folder of uncategorized files that I need to put into separate folders. But I have to look at each program individually to decide where it goes. The extension already makes it way more efficient to do with keyboard shortcuts, but it's a small annoyance having to navigate back to the source folder and find my place each time. Agree, some folks may prefer switching to the target folder, that's probably the right thing to do when moving one file (and how is the extension to know you're doing one vs many?).

I have a folder INCOMING, with 400 programs in it, and they need to be moved into folders A, B, C, D based on reviewing the content, not the file name - that's the use case. I'm already done with this exercise now, but it comes up pretty regularly in the work I do. I'm not usually allowed to install Midnight Commander or other file managers, so FileBunny was a great find for me - thanks so much for releasing!