Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Revamp project switching #393

Open
maxamundsen opened this issue Aug 5, 2024 · 2 comments
Open

[Feature Request] Revamp project switching #393

maxamundsen opened this issue Aug 5, 2024 · 2 comments

Comments

@maxamundsen
Copy link
Contributor

(Similar issue to #360)

In my opinion, the user experience of loading project files can be significantly improved. Currently, if you want to load a project outside the global project dir (perhaps you keep the project in VCS), you need to exec focus from the CLI in a dir containing a .focus-config. This is cumbersome, and it would be nice to be able to load these files directly from focus without needing the terminal. It would also be nice to keep a list of recently loaded project files that may be located across the system for quick access. This change would remove the need for a global project directory since projects can be referenced "globally" via the filesystem, or quickly via the "recents" menu.

With these changes, it would also be very handy to reference files/directories inside a project relative to the project file, instead of needing to specify an absolute path. This would apply to [[workspace]], [ignore], [allow], and [[build commands]].

Modified commands:

  • "Switch To Project": Instead of searching the global projects folder, prompt user to find a file with a .focus-config extension. If the file is a valid project file, load it, and push the name, and path to a recent-projects.txt. If that project was already in the recents list, move it to the top of the list.

New commands:

  • "Switch to recent project": Displays a list of recent project names (and perhaps their path) specified in recent-projects.txt. Loading a project will always move it to the first position in the list, displaying it first in subsequent calls to the "switch to recent project" command.
  • "Clear recent projects": Clears list of recent projects.

New options for global config:

  • open_recent_project_on_launch - Boolean that would determine if focus should load the most recent project in the recent list on program init.

Changes to project config:

  • Add a %PROJECT_CWD% variable, which would resolve to the directory of the project file. This would allow for configuration relative to the project file for build commands, and ignore/allow dirs.

Obviously any commands that utilize the 'recent file' will attempt to access/modify a file on disk, so an error message would need to display if the file is inaccessible.

@focus-editor
Copy link
Owner

Looks like these things are mostly implemented?

@maxamundsen
Copy link
Contributor Author

Yes! The only thing I would add to this is the ability to load a project from a directory containing a .focus-config via the editor itself, and not the CLI.

Somebody in the discord suggested the following: Add a dialog that allows you to open a directory. If that directory contains a .focus-config, load that project. If the selected directory is NOT a project, set that directory to the current workspace as if you launched focus via the cli with that directory as an argument.

Otherwise these changes have been really nice and I'm glad that they were added. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants