livebook/test/support/noop_runtime.ex
Jonatan Kłosko 6b78258713
Add support for scanning evaluation context from smart cells (#1041)
* Add support for scanning evaluation context from smart cells

* Rename prev_locator to base_locator to clarify the meaning

* Adjustments

* Add data tests

* Adjustments

* Test smart cell intearaction with RuntimeServer

* Serialize binding scanning and leave sending to the user

* Monitor the scanning process
2022-03-05 13:19:42 +01:00

32 lines
957 B
Elixir

defmodule Livebook.Runtime.NoopRuntime do
@moduledoc false
# A runtime that doesn't do any actual evaluation,
# thus not requiring any underlying resources.
defstruct []
def new(), do: %__MODULE__{}
defimpl Livebook.Runtime do
def connect(_, _), do: make_ref()
def disconnect(_), do: :ok
def evaluate_code(_, _, _, _, _ \\ []), do: :ok
def forget_evaluation(_, _), do: :ok
def drop_container(_, _), do: :ok
def handle_intellisense(_, _, _, _, _), do: :ok
def duplicate(_), do: {:ok, Livebook.Runtime.NoopRuntime.new()}
def standalone?(_), do: false
def read_file(_, path) do
case File.read(path) do
{:ok, content} -> {:ok, content}
{:error, posix} -> {:error, posix |> :file.format_error() |> List.to_string()}
end
end
def start_smart_cell(_, _, _, _, _), do: :ok
def set_smart_cell_base_locator(_, _, _), do: :ok
def stop_smart_cell(_, _), do: :ok
end
end