Splitting this out from #503 (opening multiple files) - from @CrossR:
Normally I'd use some form of fuzzy file opener to just open up more tabs/splits, but I'm also having an issue where that isn't opening the current directory...I can open a separate issue for that though.
This occurs with 0.25 and 0.26rc in Windows 10.
And it looks like the behavior is as follows:
It's not empty, it's just regardless of where my file is open, it only shows files relative to oni in some fashion, I think the electron folder. If I swap the search command to the suggested windows one in Config.ts, It swaps to the program files folder that oni is installed in.
Just a couple of follow-up question on my end (and thanks @bert88sta for drilling into the behavior)
Right now the Fuzzy Files / QuickOpen experience uses the current working directory from Neovim, and it defaults to wherever Oni was opened.
It sounds like the expectation here is to set the working directory along with opening the file, which makes sense to me. It doesn't really make sense for Oni to have the working directory stick around as the install directory when you explicitly open a file.
Maybe a behavior we can start with here is that, if the working directory hasn't been changed (is the install folder), we should just change it with the first file that is opened - that would smooth out this experience.
This also aligns a bit with the autochdir setting in Vim/Neovim.
A couple of other things I'm thinking about that don't have answers right now:
package.json or *.csproj respectively - would it make sense to be smart and look upwards to grab that folder? This is something a plugin could also handle, or the language client could handle, since it does this traversal anyway.Open Folder option that just changes the working directory?So, normally I'm opening Oni via the start menu. Using :pwd like that returns F:Program FilesOni, which is the install directory I have.
Opening it via cmd/powershell, :pwd instead returns the folder I was in when I opened Oni.
So yeah, it is set to wherever Oni is started from. From the shell that is the current folder, but from the Start menu this is just the Program files folder.
Incidentally, setting the "autochdir" flag in my init.vim made this work as I'd expect. Each tab and split had its own fuzzy files in the folder the file resides in, which is at least better than only having it in the install dir. From looking on the vim wikia, it seems this option doesn't always play nice with plugins, so maybe its worth looking into a more permanent solution. It does mention using autocmds instead for the same effect.
As for the other considerations:
Incidentally, setting the "autochdir" flag in my init.vim made this work as I'd expect.
As a short-term solution to this issue, should we add autochdir to Oni's default init.vim? It seems like a reasonable expectation for new users and people with complex init.vim files which may conflict with that setting will most likely be disabling our default init.vim anyway.
A further interesting effect of note (slightly different but I found it while messing around with this issue at hand) is that if in init.vim you set it to automatically cd to a directory you desire then even though the pwd suggests you are at that directory the fuzzy search still works from the oni directory as if no cd happened. However you are actually at the new directory and if you cd up or down 1 directory then fuzzy search starts to work properly. So essentially I assume Oni needs a check on startup to have the fuzzy search's current directory updated if it gets changed in the init.vim.
...if in init.vim you set it to automatically cd to a directory you desire then even though the pwd suggests you are at that directory the fuzzy search still works from the oni directory as if no cd happened. However you are actually at the new directory and if you cd up or down 1 directory then fuzzy search starts to work properly.
Oh, interesting, thanks for the note @kornabert . Oni listens to the DirChanged autocmd from Neovim - I wonder if in the autochdir case that autocmd isn't being triggered?
I suggest whenever you are in the in QuickOpen, and you call show()
if you are in the install directory (is this possible to make a global var/envionrment var when installing?) instead of
UI.Actions.showPopupMenu("quickOpen", [{
icon: "refresh fa-spin fa-fw",
label: "Loading Files...",
detail: "",
pinned: false,
}])
show something along the lines of bookmarks the user can set in the config file, which then will change to a directory, which will make fuzzy finding work in that new directory.
I know you are working on #554 issue with async handling for large directories, but this might be a neat feature for if you start oni from a desktop icon.
I don't know typescript very well but I can try hacking at it when I get some time tomorrow, I will let you know if I make any strides, assuming you like this idea.
Thanks for the idea, @cyansprite ! Having QuickOpen show files from the install directory is almost never what the user would intend, or expect, so showing bookmarks or projects set in the config file sounds like a great option. I like the idea a lot!
is this possible to make a global var/envionrment var when installing?
We can actually figure out the install directory based on the value of process.execPath. For example, for Oni, installed in Windows, process.execPath is C:\Program Files (x86)\Oni\Oni.exe on my machine. The nesting is a bit different for OSX and Linux, but in all cases, we can derive the install directory from this variable.
So it sounds like there would be 3 parts to this:
1) Figure out the install directory, as described above
2) Add a configuration setting for project paths. Maybe something like project.paths or bookmark.paths. The place to add this would be oni/browser/src/Config.ts.
3) Update the QuickOpen logic to check for the install directory (using the logic in #1), and if that is the case, popup a menu showing the bookmarks / projects specified in the config. Most of that logic is in oni/browser/src/Services/QuickOpen.ts, in the show method.
Thanks for offering to hack at it - if you want to give it a shot, that would be great! Let me know if get stuck or need help.
I split out #566 from this - which is specifically adding an "Open Folder" option to the menu. This could be done separately from the items called out above (adding projects / bookmarks), so I thought it made sense to have a separate issue
@extr0py Can you assign me?
I don't know how assigning works, I've never worked on github with anyone.
for now I'm using this "chain"
http://fontawesome.io/icon/link/
I have it working but when building the exec path is pointed to electron under the oni github directory, is there a way for me to package it and download it to ensure it works?
@extr0py I submitted a pull request, let me know what you think.
@extr0py Can you assign me?
I don't know how assigning works, I've never worked on github with anyone.
It's weird - looks like only collaborators (so myself & keforbes) show up in the assignees list. Looks related to this github issue: https://github.com/isaacs/github/issues/100
But it's great to have you working with us 馃槃
for now I'm using this "chain"
http://fontawesome.io/icon/link/
Perfect! We'll probably need to experiment a bit and see what an intuitive experience for this is, but I think the chain represents the bookmark/link idea.
I have it working but when building the exec path is pointed to electron under the oni github directory, is there a way for me to package it and download it to ensure it works?
Yes, just depends which OS you're on. I'm assuming you've done a build (npm run build) prior.
__Windows__
npm run dist:winnpm run pack:winAfter those two commands, you should now have a setup exe in your oni\dist folder
__OSX & Linux__
npm run packYou'll find the output in the same place - oni\dist.
I use these a lot when testing the installer scenarios. Let me know if you have issues getting those work.
I'll take a look at the PR shortly!
@extr0py
Okay the run dist:win and pack:win it's not working debugging as to why right now, will make another commit and update PR. Thank you!
I will also test on Linux later. Won't be home much today but I will try to get it done
Oh haha I need to add Oni :).
if (path.dirname(process.execPath) === process.cwd()) {
Also we should check if ~ because i doubt the user would ever want that as well.
Okay the run dist:win and pack:win it's not working debugging as to why right now, will make another commit and update PR. Thank you!
Bummer, @cyansprite - let me know if you're getting an error message or something. I can help you troubleshoot a bit!
Also we should check if ~ because i doubt the user would ever want that as well.
Good call.. both #554 and #177 are related to this!
Also i noticed that if you select loading files it tried to open loading files..
Going to fix that and also going to detect if bookmarks is empty then offer to direct to oni config.
Also with my plugin im making I've researched file types that are never to be opened so i compiled a list and I think i can write some kind of binary checker to ensure we don't open binary files or show them such as .exe
Almost done :)...
@extr0py npm run pack
if on ubuntu need to run (if not already)
sudo apt install rpm
that way you have rpmbuild