Drafter.Syntax.TSFeatures (drafter v0.3.1)

Copy Markdown View Source

Parses Tree-sitter-style captures into structured highlight, fold, symbol, and textobject data.

Summary

Types

capture()

@type capture() ::
  {pos_integer(), non_neg_integer(), pos_integer(), non_neg_integer(),
   String.t()}

span()

@type span() :: {non_neg_integer(), non_neg_integer(), atom()}

t()

@type t() :: %Drafter.Syntax.TSFeatures{
  folds: list(),
  highlights: %{required(pos_integer()) => [span()]},
  symbols: list(),
  textobjects: list()
}

Functions

build(captures)

@spec build([capture()]) :: t()

get_spans(ts_features, line)

@spec get_spans(t(), pos_integer()) :: [span()]

highlight_type?(name)

@spec highlight_type?(String.t()) :: boolean()