Oni: Feature: Projects. Easily switch between coding Projects

Created on 15 May 2018  路  6Comments  路  Source: onivim/oni

Forgive me if I'm doing something wrong, this is the first time I've made a Feature Request for Oni.

I would like to develop a feature to be implemented into Oni, however, instead of going through all the effort for nothing, I would like to have it approved first.

For a brief summary, I am going to add either another menu button between Oni and Edit called Project, or an icon to the left of the explorer
This menu item will have this subset of items along with a description of what they will do

  • New Project

    • Clicking on this will give a prompt to select which directory you would like to be the root of the project

    • You will be able to enter a name for the project otherwise it's defaulted to a humanized version of the folder name

    • After a root is selected, the current project will be saved and the whole environment will be switched to a new empty environment with the Explorer set to the new project root.

  • Open Project

    • This will have a small list of all the projects you have saved, and when selecting one it will save the current project and load that project in the existing window

  • Open Project In New Window

    • Same as above but open a new window

  • Delete Project

    • Remove the project from Oni, and keep the directory associated with it

I intend for each project to do these things

  • Keep a record of the root of the project, which can also be changed.
  • Keep a snapshot of all the open buffers, tabs, location inside the buffers and their changes and their state, even if they are unsaved

    • Each of these snapshots will be completely isolated depending on which git branch you are on

    • Checking out a new branch will create a copy of the current snapshot to be the snapshot of the branch being checked out

When you open Oni it will remember what project you were last on and it will use that.

I realize that this kind of thing is already possible to do with Promiscuous, but that is kind of the point of the IDE to make things out of the box awesome.

Most helpful comment

Thanks for the input here guys! I will do some research on the points mentioned and dive into how I'm going to accomplish this and add to this Issue as I progress. I think that #1582 goes quite a bit beyond the scope of what I am wanting to implement, but I might look into it regardless because I do like the idea there.

All 6 comments

Hello and welcome to the Oni repository! Thanks for opening your first issue here. To help us out, please make sure to include as much detail as possible - including screenshots and logs, if possible.

This is somewhat related to Session management in Vim, which we spoke about on Discord a while back but I think never made it into an issue.

I think the main point there was that ideally, this style of functionality would also work for the multiplexed editors that Oni supports. That is, when "editor.split.mode": "oni", is set, so there is multiple instance of neovim sat around. This just changes it from "save all open buffers/locations/etc" to "save all open buffers/locations/etc for all editors".

A second point I'd have is that whilst its nice having it in the menu since that is probably where you will look first, a sidebar entry would be a nice addition also. That then means you can navigate and swap between projects without having to use the mouse. Or maybe if we added it to the API, that way users can bind it / make menus for it themselves...

That said, I'm not saying we'd need all that in one go, it would make sense to build up the feature, both to make testing easier, but also to get it out quicker and have it be used.

For the idea in general though, I'd love something like this! I'm currently using a vim plugin to manage my sessions, but if we could move it into Oni it would have the ability to work with a bit more of the Oni specific functionality which would be great.

@jeffreydvp just wanted to point you to a few issues that exist around this i.e. ideas and points that have been raised - https://github.com/onivim/oni/issues/1225, https://github.com/onivim/oni/issues/1582

Re. this functionality its definitely something that I'd also like to see. Just a couple of things it be great to see with this is that however the ui manifests it v. keyboard accessible, although as it would likely involve using some of the existing components most of which are already targeted towards that hopefully that might be factored in by default.

Also I wonder how you were intending to manage the project/session @bryphe mention some ideas - hope he doesn't mind me adding what he already shared on the subject in here.

I think it would be awesome to have session management built in! I liked the direction where this was going: https://github.com/onivim/oni/issues/1582

Either exposing a list of sessions in the sidebar, or at the top of the editor - making it really easy to switch between them. I jump between projects frequently so it would be great to not have to rebuild the context each time.
I'm thinking of how it would work in the Oni world, though - I'd want the session management to support the multiplexed editors - in other words, it would have to be implemented outside VimL to scale to that scenario.
What I thought about was adding a persistSession: Promise and restoreSession(data: any): Promise for the Editor interface (or perhaps Window objects - that would let us persist state for stuff like the sidebar and file explorer even, if we wanted..)
NeovimEditor would of course need to use :mksession as part of that, so it might write out the session file and save it as a string. Then, when we call persistSession and restoreSession on the editor, for the NeovimEditor, it would use mksession / so to store/restore the session info. But it could also scale to other types of editor strategies too.
At the high-level, we could have some object like PersistentSessions that handles calling persist/restore on all the relevant entities, collect the data, and save the file somewhere (which would be an aggregated of all the session date).

Thanks for the input here guys! I will do some research on the points mentioned and dive into how I'm going to accomplish this and add to this Issue as I progress. I think that #1582 goes quite a bit beyond the scope of what I am wanting to implement, but I might look into it regardless because I do like the idea there.

@jeffreydvp 馃憤, yeah #1582 is more there for inspiration, than any kind of requirement any step(s) towards this functionality would be fantastic

I've just made a comment to #1582 and for flexibility it would be the best if we have Projects > Workspaces > Oni splits/tabs/vim splits

It sounds complicated but would be the most reasonable thing. The additional workspaces would have their own function:

  • Project is for the basic environment and sessionhandling
  • Workspaces are for storing different layouts, e.g. css - html, db - php, etc.

Having only either Workspaces or Projects seems a bit limited in my eyes and I think it makes way more sense to have workspaces as part of a project than as part of the layout.. Or what do you think?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timeyyy picture timeyyy  路  3Comments

grz8 picture grz8  路  3Comments

magopian picture magopian  路  3Comments

Canop picture Canop  路  3Comments

Siilwyn picture Siilwyn  路  3Comments