Skip to main content

Module scope_detector

Module scope_detector 

Source
Expand description

Grammar-driven named-scope detection via tree-sitter tags.scm queries. Grammar-driven named-scope detection via tree-sitter tags.scm queries.

Every tree-sitter grammar ships a queries/tags.scm file, consumed by GitHub code navigation, Helix, and the tree-sitter tags CLI. The capture vocabulary is standardized:

  • @definition.function / @definition.method / @definition.class / @definition.module / @definition.interface / @definition.type / @definition.macro (and more): the scope node
  • @name: the identifier within the scope node

This module wraps tree-sitter-tags to produce a uniform NamedScope view of source code across all 248 supported languages. The walker uses the resulting scope map to drive named-scope detection without any hardcoded node-kind lists.

Structs§

NamedScope
A named scope discovered by the tags query.
ScopeDetector
A reusable per-language detector that runs a tags query over source bytes and yields NamedScopes.

Enums§

ScopeKind
Grammar-declared scope kind, parsed from the @definition.* capture.