Composer.LSP.Diagnostics (composer v0.2.0)

Copy Markdown View Source

The diagnostics of a saved recipe group file and of the files that include its recipes, from disk.

The file's recipes are read with Composer.Recipe.Locator (so even a file that does not evaluate names them), their dependents found with Composer.Lint.dependents/3, and everything linted in one pass with Composer.Lint.files/3, given what mix composer.cookbook.lint --file gives it, so the results are the same.

The dependents linted last time are linted again, so a file that no longer includes the saved one (or that was fixed by the save) has its diagnostics cleared.

Summary

Functions

Lints path and its dependents. Returns :ignore for a file that is not a recipe group, or {:ok, %{path => diagnostics}, dependents}.

Types

args()

@type args() :: %{
  cookbooks: [Composer.Cookbook.t()],
  local_dir: Path.t() | nil,
  root: Path.t() | nil,
  known_dependents: [Path.t()]
}

Functions

run(path, args)

@spec run(Path.t(), args()) ::
  :ignore
  | {:ok, %{required(Path.t()) => [Composer.Lint.Diagnostic.t()]}, [Path.t()]}

Lints path and its dependents. Returns :ignore for a file that is not a recipe group, or {:ok, %{path => diagnostics}, dependents}.