Minga.Project.FileRef (Minga v0.1.0)

Copy Markdown View Source

Logical file identity for workspace membership.

A file ref identifies the user's logical file, not a future backend or overlay path. Path refs are scoped to an expanded project root plus a normalized relative path. Buffer refs identify unsaved or special buffers by their live buffer pid.

Summary

Functions

Returns the display label for a file ref.

Returns true when two refs identify the same logical file.

Builds a buffer-backed logical file ref for an unsaved or special buffer.

Builds a path-backed logical file ref scoped to a project root.

Types

kind()

@type kind() :: :path | :buffer

t()

@type t() :: %Minga.Project.FileRef{
  buffer_pid: pid() | nil,
  display_name: String.t(),
  kind: kind(),
  project_root: String.t() | nil,
  relative_path: String.t() | nil
}

Functions

display_label(file_ref)

@spec display_label(t()) :: String.t()

Returns the display label for a file ref.

equal?(arg1, arg2)

@spec equal?(t() | nil, t() | nil) :: boolean()

Returns true when two refs identify the same logical file.

from_buffer(buffer_pid)

@spec from_buffer(pid()) :: t()

Builds a buffer-backed logical file ref for an unsaved or special buffer.

from_path(project_root, path)

@spec from_path(String.t(), String.t()) :: {:ok, t()} | {:error, :outside_project}

Builds a path-backed logical file ref scoped to a project root.