Skip to main content

category_for_node_kind

Function category_for_node_kind 

Source
pub fn category_for_node_kind(
    node_kind: &str,
    _language: &str,
) -> Option<&'static str>
Expand description

Maps a tree-sitter node_kind to the built-in category it belongs to.

Returns None if the node kind does not belong to any category. The _language parameter is reserved for future per-language overrides.

ยงExamples

use sdivi_patterns::queries::category_for_node_kind;

assert_eq!(category_for_node_kind("try_expression", "rust"), Some("error_handling"));
assert_eq!(category_for_node_kind("await_expression", "rust"), Some("async_patterns"));
assert_eq!(category_for_node_kind("unknown_node", "rust"), None);