mogelbrod / quick-opener

Visual Studio Code plugin that makes it easy to work with files across the entire file system
https://marketplace.visualstudio.com/items?itemName=mogelbrod.quickopener
MIT License
4 stars 1 forks source link

Open folder on `<enter>` #3

Open emlautarom1 opened 2 months ago

emlautarom1 commented 2 months ago

Currently, I'm looking for a replacement for the "simple file dialog" in VSCode since by default TAB does not autocomplete but instead switches focus between UI elements unlike your extension which autocompletes the path.

Currently, I'm struggling to get the keybindings to work to get the following behavior:

In the last case, when I press enter nothing happens until I change the focused item (down-arrow, up-arrow) to a File inside the Directory. After changing the focus, pressing enter refreshes the "Quick Opener" view and uses the Directory as a "root" path to search again for a file to open.

What I would like to do is that on the first enter, if a File is selected then it should be opened in the current editor area, if a Directory is selected then it should open the folder in the current window (like the F1 > File: Open Folder... command), and if I write a path that it does not exist then it should create it.

mogelbrod commented 2 months ago

Would you want enter on a directory to always trigger the "Open folder" action, even when the current vscode window already has a workspace (folder) opened? That is, should it open another window? I think it might be preferable for it to act like ctrl+o in the current QuickOpener version, eg. open folder if none has been opened, or add folder to workspace if a folder has already been opened.

emlautarom1 commented 2 months ago

I think it might be preferable for it to act like ctrl+o in the current QuickOpener version, eg. open folder if none has been opened, or add folder to workspace if a folder has already been opened.

As a starting point would like to somehow remap Ctrl+o to <enter> to open a folder when the current window has no workspace or add it to the workspace when one is already present.

Personally, my use case is as follows:

mogelbrod commented 2 months ago

Got it!

  • If there is a folder open in the current workspace, <enter> should replace the currently open folder in the current window (unlike Ctrl+o that opens a new window)

I'm not sure if this is easily implementable, but will look into it when time allows.

Note to self: These may be usable https://github.com/microsoft/vscode/blob/c67ccc70ece5f472ec25464d3eeb874cfccee9f1/src/vs/platform/windows/electron-main/windowsMainService.ts#L274 https://github.com/microsoft/vscode/blob/c67ccc70ece5f472ec25464d3eeb874cfccee9f1/src/vs/platform/windows/electron-main/windows.ts#L98