-
Notifications
You must be signed in to change notification settings - Fork 129
Switch to project or create new #595
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
base: main
Are you sure you want to change the base?
Switch to project or create new #595
Conversation
|
Let me know what else needs to be changed, I'm still figuring out the codebase. |
|
Thanks for your MR - I will review this when I can, quite busy now, sorry |
|
I'm still busy but I've had a quick look and I can already say that I don't want to mix switching to project and the creation of a new project. Instead the plan was to add a new dialog where the user would just type the name of the project without specifying any path and it would save it to the global project directory. Then we wouldn't have to pollute the existing dialogs with this extra logic and also would avoid the users accidentally creating new projects when they mistype the name of the project they want to switch to. Also, the convention going forward is to keep the name of the action as close to the display name of the action as possible - i.e. we shouldn't call an action "Open Project" when the underlying action in code is called |
|
I see, yeah I was unsure of how you wanted to approach the issue. My idea was to try to contain the amount of commands. In this case I agree that having a dedicated "new project" probably makes more sense. I'll see if I can add that instead in the coming days. Thank you for the feedback! |
|
I have some questions I have been thinking about:
|
|
These are difficult questions - at this point I'm not sure what would be best, but this is what I had on my list - this is not a 100% list of things to do but just some notes for myself for when I pick this up, which seemed reasonable when I was thinking about it: If you'd like to work on this I'd be happy with that, if you're okay with some back and forth and potentially redoing things a couple of times. Otherwise I'll do it myself when I'm able to. One more thing - I have a couple of branches with some serious refactoring going on around config and file watchers, so it's best not to touch config internals if possible, or there are going to be conflicts. |
Some minimal contents, maybe similar to what the Example Project file contains |
|
Nice, I would love to work on this! I'm ok with doing some back and forth. It might take a while but that's ok. I'll check #393 and also what you are doing with config and file watcher so I know what not to touch. This is a bigger project than I was expecting 😅 but I think it will improve usability a lot. I think I will get back to you with a plan before I actually start changing stuff around. |
|
So, initially I was thinking of adding a bunch of commands like "open project file", "new project", "new project file", "new project from folder" and so on but it didn't feel like it fit focus. There were too many edge cases. So here's what I think is best, which would build on the system as it currently is. Let me know what you think. If you like the idea I will start working on a proof of concept implementation. We have the concept of project config which only exists when a project is open. My plan is to extend this concept to always existing even if no project is open. Think of it as a "workspace" config. To do so, when no project is open there will still be a config which will act as backed by a file, but it won't be (I guess it could also be backed by a temporary file). Meaning, you can save it, which will reload the "project" with the changes you made. And save it as, which will effectively create a new project by making it backed by a file. Once this core feature is there we can get everything else we want organically. I believe. New/modified commands
Note:
ExamplesAll of the following examples assume you have no project open, but will work if you do have one open. They will just achieve something different.
|
Not sure why those commands would be needed, you're right that we should keep things simple.
I feel like this is already overcomplicating things. If no project is active, the user shouldn't be able to open its config file. Also remember that changing the way configs get loaded and applied would conflict with my config system rewrite.
I'm not seeing why it would no longer be necessary - it's still useful for people to reference after their custom configs have diverged from the default one.
Why? There's already
I would suggest to call it
I think it already acts like this.
It is useful and it was in the plan. It should also be easy to implement - just make it do what the To reiterate, I don't think we should be introducing virtual projects. Everything that was planned as part of this work should be naturally implementable without adding new concepts |
Sure, that's a good point. If for example you want to open a folder without creating a project first as you can do in many other editors, be it in memory or in a temp file, somewhere there must be a temporary "workspace config" that contains the currently tracked folder/s and so on. So, my proposal was to make that accessible to the user until it becomes a project file, that way they can change settings and add folders the same way they normally would. This would be the same behavior as VSCode. There is a workspace settings tab if you have a folder open (or a project obviously), they will create .vscode folder with workspace settings when you commit changes; if you have multiple folders in the workspace they will create a temporary workspace in AppData until you save it. I do concede that the naming it project-config might be confusing there, so following them and calling it workspace-config would be best imo. I think in general it's a common pattern to open a text editor, open some folders, change some configs and then once it's set up, save the workspace to a file as a project --or maybe not--. So, I wanted to facilitate that workflow by delaying asking the user to make choices until it's unavoidable (e.g. picking where the project should go). Moreover it would remove the need for a new_project command, as closing the current project and adding a folder to the workspace (or opening a new focus instance) would be enough. If you think there could be conflict between implementing this and your config and file watcher rewrite let me know and we can pause this until those are done. If instead you prefer not allowing users access to settings until they have created a project I understand and will move on with that. |
|
somewhere there must be a temporary "workspace config" that contains the
currently tracked folder/s and so on
There's the in-memory config which contains everything, when the user opens
a folder, that in-memory workspace dir array will get modified, then if the
user wants to save that as a project, the information can be taken from
there to generate a config file. No need to invent any new concepts.
…On Sat, Sep 27, 2025, 11:09 PM Filippo Crocchini ***@***.***> wrote:
*filippocrocchini* left a comment (focus-editor/focus#595)
<#595 (comment)>
I feel like this is already overcomplicating things. If no project is
active, the user shouldn't be able to open its config file. Also remember
that changing the way configs get loaded and applied would conflict with my
config system rewrite.
Sure, that's a good point. If for example you want to open a folder *without
creating a project first* as you can do in many other editors, be it in
memory or in a temp file, somewhere there must be a temporary "workspace
config" that contains the currently tracked folder/s and so on. So, my
proposal was to make that accessible to the user until it becomes a project
file, that way they can change settings and add folders the same way they
normally would. This would be the same behavior as VSCode. There is a
workspace settings tab if you have a folder open (or a project obviously),
they will create .vscode folder with workspace settings when you commit
changes; if you have multiple folders in the workspace they will create a
temporary workspace in AppData until you save it. I do concede that the
naming it project-config might be confusing there, so following them and
calling it workspace-config would be best imo.
I think in general it's a common pattern to open a text editor, open some
folders, change some configs and then once it's set up, save the workspace
to a file as a project --or maybe not--. So, I wanted to facilitate that
workflow by delaying asking the user to make choices until it's unavoidable
(e.g. picking where the project should go). Moreover it would remove the
need for a new_project command, as closing the current project and adding a
folder to the workspace (or opening a new focus instance) would be enough.
If you think there could be conflict between implementing this and your
config and file watcher rewrite let me know and we can pause this until
those are done. If instead you prefer not allowing users access to settings
until they have created a project I understand and will move on with that.
—
Reply to this email directly, view it on GitHub
<#595 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A4OX77XQV4RC57334JPIGGL3UZV7BAVCNFSM6AAAAACGWCBBR6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGNBRGUZDSNBVGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
|
I don't think I have as much time as I thought to work on this, I have been trying but I keep having to postpone it because of work and other stuff. I don't want to promise something I can't deliver. I don't know if you want to close this, but I don't think I will manage to implement this within the coming months. Maybe someone else can continue :/ |
|
I totally understand. Let's keep it open for now and then we'll see if we're able to continue this. Thanks for going this far with this. |
This closes #152.
When switching to a new project allow for creating a new one the same way as you do by saving a file.
This also include a small fix to the open file dialog, it no longer shows the save as option if the file name matches exactly with an existing file.
This is what it looks like:

After a new project is created and switched to, it will open the newly created project config so that you can edit it.
I added "Open or Create a Project" to the welcome screen. I also tweaked the vertical alignment of the right side so that it's visually centered with the left side.
