Projects

Projects are used to determine the project root for project-wide actions like renaming a symbol or generating autocomplete suggestions.

The project selector button at the top of the left pane indicates which project is currently selected and allows you to switch between projects.

Selecting an editor tab automatically selects the associated project. An associated project can be one that you have saved explicitly, or an implicit project (see Implicit and Explicit/Saved Projects below).

The selected project and the file tree view (below the project selector) work independently: the file tree can be open at a different directory than any of the selected project’s roots.

Project Roots

Projects can have multiple roots. These correspond to LSP workspace folders. [TODO there is currently no way to add another root to an existing project].

Implicit and Explicit/Saved Projects

You can create a project manually by selecting New project from the project selector. This will prompt you to select one or more directories for the roots. Once you create a project it will be saved to your data dir (~/.edita/projects) and will take priority when determining which project a file belongs to (see Project Resolution below).

Project Resolution

When Edita needs to find or create a project to associate with a file (for example when generating autocomplete suggestions), it first checks existing saved projects and then implicit projects to see if any of them “own” the file (whether the file is a descendant of any of the project’s roots). If it doesn’t find one, it creates one and adds it to the list of implicit projects.

To determine what the project root should be for implicit projects, Edita searches a file’s parents to see if any of them contain a pre-defined list of “project root files”. These include .git, src, license, and language-specific files such as package.json, cargo.toml, and Makefile. These matches are case-insensitive. If no match is found, the project root is the file’s immediate parent.

Uniqueness

Projects are identified by their roots: you can only have one project per combination of root directories.