Ragex.Analyzers.SCIP.Indexer (Ragex v0.18.4)

View Source

Orchestrates external SCIP indexer binaries.

Runs the appropriate SCIP indexer (e.g. scip-go, rust-analyzer, scip-java) in the project directory, producing an index.scip file. Then converts it to JSON via scip print --json for parsing.

All external processes run with configurable timeouts and are killed if they exceed the limit.

Flow

  1. Detect language from project marker files
  2. Check that the indexer binary is available
  3. Run the indexer -> produces index.scip
  4. Run scip print --json index.scip -> JSON output
  5. Return JSON string for the Parser to consume

Configuration

config :ragex, :scip,
  indexer_timeout: 300_000,   # 5 minutes default
  index_file: "index.scip"   # default output filename

Summary

Functions

Convert an existing SCIP index file to JSON using the scip CLI.

Check if a SCIP index file already exists for a project.

Run a SCIP indexer for the given language in the project directory.

Auto-detect languages and index all of them.

Functions

convert_to_json(project_dir, index_file \\ "index.scip")

@spec convert_to_json(String.t(), String.t()) :: {:ok, String.t()} | {:error, term()}

Convert an existing SCIP index file to JSON using the scip CLI.

Useful when the index was generated externally (e.g. by CI).

find_existing_index(project_dir)

@spec find_existing_index(String.t()) :: String.t() | nil

Check if a SCIP index file already exists for a project.

Returns the path if found, nil otherwise.

index(project_dir, language, opts \\ [])

@spec index(String.t(), String.t(), keyword()) :: {:ok, String.t()} | {:error, term()}

Run a SCIP indexer for the given language in the project directory.

Returns {:ok, json_string} with the JSON representation of the SCIP index, or {:error, reason}.

Options

  • :timeout -- max time for the indexer to run (default 5 min)
  • :index_file -- output filename (default "index.scip")

index_all(project_dir, opts \\ [])

@spec index_all(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}

Auto-detect languages and index all of them.

Returns {:ok, results} where results is a map of %{language => {:ok, json} | {:error, reason}}.