File tree sub-state: tree data, focus, and backing buffer.
Wraps the file-tree-related fields from EditorState into a single struct with query and transition helpers. Includes inline editing state for new file, new folder, and rename operations.
Summary
Types
Single owner tag for resident file-tree content.
Inline editing state for creating files/folders or renaming entries.
Identity of the latest admitted filter request.
Explicit user interaction phase for the file tree sidebar.
Derived presentation state for the file tree sidebar.
File tree sub-state.
Explicit visibility phase for the file tree sidebar.
Functions
Accepts the current filter and leaves the narrowed tree visible.
Installs a current filter result prepared by a scheduler worker.
Atomically accepts a current refresh result or identifies why it cannot apply.
Collapses watcher lineage only for the latest exact successful request.
Publishes an immediate loading tree for a root scan without resolving entries.
Cancels inline editing, clearing the editing state back to browse.
Changes the watcher target to cleanup-only while retaining all known roots.
Clears a pending file tree clipboard operation.
Publishes an unfiltered loading tree while preserving filter-input disposition.
Closes the tree and clears the buffer.
Marks the sidebar as failed with a displayable reason.
Terminalizes watcher retry correlation after the bounded attempt budget.
Reports a current filter failure while preserving recovery on the next query.
Finishes a current failed or canceled filter request without installing rows.
Finishes a failed or canceled current request without changing tree content.
Finishes watcher work without discarding cleanup candidates.
Marks the visible file tree as focused.
Hides the sidebar while keeping the loaded tree, backing buffer, and watchers.
Hides the file tree help overlay.
Returns true when the file tree has loaded data.
Marks the sidebar as loading.
Stores a pending file tree clipboard operation.
Consumes a correlated debounce message and focuses the result on the live tree.
Reports a refresh failure while preserving the open tree interaction state.
Replaces metadata on the current tree without changing topology status or refresh correlation.
Records one debounced request to refresh the open tree.
Returns the monotonic generation of the current root and watcher lineage.
Installs an empty failed root scan while retaining the requested root.
Correlates a bounded watcher synchronization retry.
Updates the project root associated with the file tree.
Replaces the tree data.
Enters inline editing mode at the given index.
Starts inline file tree filtering without resolving any rows.
Toggles the file tree help overlay.
Correlates the latest admitted filter request with its exact root and query.
Correlates an admitted typed refresh request with the root it scans.
Re-arms one pending refresh intent after scheduler admission pressure.
Correlates the latest admitted watcher synchronization request.
Marks the file tree as unfocused.
Updates the text being typed in the inline editor.
Publishes a loading filter transition without cache or filesystem calls.
Returns the immutable watcher intent owned by this file tree.
Consumes only the current watcher retry timer.
Types
@type clipboard_mark() :: MingaEditor.State.FileTree.ClipboardMark.t()
@type clipboard_operation() :: MingaEditor.State.FileTree.ClipboardMark.operation()
@type content() :: :closed | {:loading, Minga.Project.FileTree.t() | nil} | {:ready, Minga.Project.FileTree.t()} | {:error, String.t(), Minga.Project.FileTree.t() | nil}
Single owner tag for resident file-tree content.
@type editing() :: %{ index: non_neg_integer(), text: String.t(), type: editing_type(), original_name: String.t() | nil }
@type editing_type() :: :new_file | :new_folder | :rename
Inline editing state for creating files/folders or renaming entries.
Present while interaction is {:editing, editing()}. The editing/1
query returns nil in every other interaction phase.
The index is the visual position in the visible entry list where
the editing row appears. For new file/folder, this is the insertion
point. For rename, this is the entry being renamed.
Identity of the latest admitted filter request.
@type interaction() :: :browse | {:editing, editing()} | :filtering | :help
Explicit user interaction phase for the file tree sidebar.
@type status() :: :hidden | :loading | :empty | :ready | {:error, String.t()}
Derived presentation state for the file tree sidebar.
@type t() :: %MingaEditor.State.FileTree{ buffer: pid() | nil, clipboard_mark: clipboard_mark() | nil, content: content(), filter_request: filter_request() | nil, interaction: interaction(), original_root: String.t() | nil, project_root: String.t() | nil, refresh: MingaEditor.State.FileTree.Refresh.t(), tree_width: pos_integer(), visibility: visibility(), watchers: MingaEditor.State.FileTree.Watchers.t() }
File tree sub-state.
@type visibility() :: :hidden | :visible | :focused
Explicit visibility phase for the file tree sidebar.
Functions
Accepts the current filter and leaves the narrowed tree visible.
@spec accept_filter_result( t(), String.t(), String.t(), reference(), MingaEditor.FileTree.FilterWalk.Result.t() ) :: {:accepted | :closed | :rerooted | :stale, t()}
Installs a current filter result prepared by a scheduler worker.
@spec accept_refresh_result( t(), String.t(), MingaEditor.State.FileTree.Refresh.request_token(), Minga.Project.FileTree.t() ) :: {:accepted | :closed | :rerooted | :stale, t()}
Atomically accepts a current refresh result or identifies why it cannot apply.
Collapses watcher lineage only for the latest exact successful request.
@spec begin_root_scan(t(), Minga.Project.FileTree.t(), :project | :reroot) :: t()
Publishes an immediate loading tree for a root scan without resolving entries.
Cancels inline editing, clearing the editing state back to browse.
Changes the watcher target to cleanup-only while retaining all known roots.
Clears a pending file tree clipboard operation.
Publishes an unfiltered loading tree while preserving filter-input disposition.
Closes the tree and clears the buffer.
Marks the sidebar as failed with a displayable reason.
Terminalizes watcher retry correlation after the bounded attempt budget.
Reports a current filter failure while preserving recovery on the next query.
@spec finish_filter(t(), String.t(), String.t(), reference()) :: {:current | :closed | :rerooted | :stale, t()}
Finishes a current failed or canceled filter request without installing rows.
@spec finish_refresh( t(), String.t(), MingaEditor.State.FileTree.Refresh.request_token() ) :: {:current | :closed | :rerooted | :stale, t()}
Finishes a failed or canceled current request without changing tree content.
Finishes watcher work without discarding cleanup candidates.
Marks the visible file tree as focused.
Hides the sidebar while keeping the loaded tree, backing buffer, and watchers.
Toggling visibility off is a pure layout change: the render model still carries the full tree data so showing it again does not rebuild anything (#2626).
Hides the file tree help overlay.
Returns true when the file tree has loaded data.
A hidden-but-loaded tree is still loaded: the data, buffer, and watchers stay
alive so refresh handlers keep it fresh. This is intentionally NOT "is the
sidebar visible" — use visible?/1 for that. Mixing the two leaks the backing
buffer (see #2626).
Marks the sidebar as loading.
Stores a pending file tree clipboard operation.
@spec open(t(), Minga.Project.FileTree.t(), pid() | nil) :: t()
@spec refresh_debounce_elapsed( t(), MingaEditor.State.FileTree.Refresh.debounce_token() ) :: {:ready, Minga.Project.FileTree.t(), non_neg_integer(), t()} | {:closed, non_neg_integer(), t()} | {:stale, t()}
Consumes a correlated debounce message and focuses the result on the live tree.
Reports a refresh failure while preserving the open tree interaction state.
@spec replace_tree(t(), Minga.Project.FileTree.t()) :: t()
@spec replace_tree_metadata(t(), Minga.Project.FileTree.t()) :: t()
Replaces metadata on the current tree without changing topology status or refresh correlation.
@spec request_refresh_debounce( t(), MingaEditor.State.FileTree.Refresh.debounce_token() ) :: {:scheduled | :already_scheduled, t()}
Records one debounced request to refresh the open tree.
@spec root_generation(t()) :: non_neg_integer()
Returns the monotonic generation of the current root and watcher lineage.
Installs an empty failed root scan while retaining the requested root.
@spec schedule_watcher_retry(t(), reference()) :: {pos_integer(), t()}
Correlates a bounded watcher synchronization retry.
Updates the project root associated with the file tree.
@spec set_tree(t(), Minga.Project.FileTree.t() | nil) :: t()
Replaces the tree data.
@spec start_editing(t(), non_neg_integer(), editing_type(), String.t()) :: t()
Enters inline editing mode at the given index.
For new file/folder, initial_text is empty. For rename,
initial_text is the current entry name.
Starts inline file tree filtering without resolving any rows.
Toggles the file tree help overlay.
Correlates the latest admitted filter request with its exact root and query.
@spec track_refresh_request( t(), String.t(), MingaEditor.State.FileTree.Refresh.request_token() ) :: t()
Correlates an admitted typed refresh request with the root it scans.
@spec track_refresh_retry(t(), MingaEditor.State.FileTree.Refresh.debounce_token()) :: {pos_integer(), t()}
Re-arms one pending refresh intent after scheduler admission pressure.
Correlates the latest admitted watcher synchronization request.
@spec tree(t()) :: Minga.Project.FileTree.t() | nil
Marks the file tree as unfocused.
Updates the text being typed in the inline editor.
Publishes a loading filter transition without cache or filesystem calls.
@spec watcher_intent(t()) :: MingaEditor.State.FileTree.Watchers.t()
Returns the immutable watcher intent owned by this file tree.
Consumes only the current watcher retry timer.
@spec width(t()) :: pos_integer()