Skip to main content

root_from_cwd

Function root_from_cwd 

Source
pub fn root_from_cwd() -> Option<PathBuf>
Expand description

The project root containing the process’s working directory, over the default markers.

The boot-time answer, for the persistent-config loader: it runs before any buffer exists (so there is nothing to resolve from) and before config has been read (so project.root-markers is not available yet — that config is what this call is on the way to loading). Everything after boot goes through the registered ProjectResolverHandle instead, which is buffer-aware and honours both :cd and the configured markers.

PR.2: this replaces Editor::workspace_root_from_cwd, which hand-walked for .git / .lattice and which each renderer called independently. Living here rather than on the host is the point — a renderer should not own a rule about where projects begin.

None only when the working directory itself is unreadable.