pub trait LanguageConfig: Send + Sync {
// Required methods
fn language(&self) -> Language;
fn extensions(&self) -> &'static [&'static str];
fn symbols_query(&self) -> &'static str;
fn calls_query(&self) -> &'static str;
fn imports_query(&self) -> &'static str;
fn comment_style(&self) -> CommentStyle;
fn resolve_visibility(
&self,
modifiers: Option<&str>,
name: &str,
) -> Visibility;
// Provided methods
fn map_capture_to_kind(&self, capture_suffix: &str) -> Option<SymbolKind> { ... }
fn adjust_symbol(&self, sym: &mut Symbol, node: &Node<'_>, source: &[u8]) { ... }
fn is_external_import(&self, module_path: &str) -> bool { ... }
}Expand description
Configuration a language must supply so the generic
QueryDrivenParser can extract symbols, calls, and imports.
Required Methods§
Sourcefn extensions(&self) -> &'static [&'static str]
fn extensions(&self) -> &'static [&'static str]
File extensions this language handles (without leading dot).
Sourcefn symbols_query(&self) -> &'static str
fn symbols_query(&self) -> &'static str
Tree-sitter S-expression query that captures symbols.
Capture names must end with a kind suffix that
default_kind_mapping (or an override of
map_capture_to_kind) understands,
e.g. @definition.function, @definition.class.
Sourcefn calls_query(&self) -> &'static str
fn calls_query(&self) -> &'static str
Tree-sitter S-expression query that captures call-sites.
Sourcefn imports_query(&self) -> &'static str
fn imports_query(&self) -> &'static str
Tree-sitter S-expression query that captures import statements.
Sourcefn comment_style(&self) -> CommentStyle
fn comment_style(&self) -> CommentStyle
The comment style used for doc-comments.
Sourcefn resolve_visibility(&self, modifiers: Option<&str>, name: &str) -> Visibility
fn resolve_visibility(&self, modifiers: Option<&str>, name: &str) -> Visibility
Resolve the visibility of a symbol from its modifier keywords and name.
Provided Methods§
Sourcefn map_capture_to_kind(&self, capture_suffix: &str) -> Option<SymbolKind>
fn map_capture_to_kind(&self, capture_suffix: &str) -> Option<SymbolKind>
Map a tree-sitter capture suffix (e.g. "function") to a
SymbolKind. The default delegates to default_kind_mapping.
Sourcefn adjust_symbol(&self, sym: &mut Symbol, node: &Node<'_>, source: &[u8])
fn adjust_symbol(&self, sym: &mut Symbol, node: &Node<'_>, source: &[u8])
Post-process hook that can mutate a Symbol after extraction.
Override this when the generic engine cannot capture all details
through queries alone (e.g. Rust pub(crate) modifiers).
Sourcefn is_external_import(&self, module_path: &str) -> bool
fn is_external_import(&self, module_path: &str) -> bool
Return true if module_path refers to an external dependency.
Paths starting with ., crate, self, or super are considered
internal by default.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".