[c]
struct = '(struct_specifier name: (type_identifier) @symbol)'
type = [
'(declaration type: (union_specifier name: (type_identifier) @symbol))',
'(type_definition declarator: (type_identifier) @symbol)'
]
function = '(function_declarator declarator: (identifier) @symbol)'
enum = '(enum_specifier name: (type_identifier) @symbol)'
[cpp]
type = [
'(type_definition declarator: (type_identifier) @symbol)',
'(enum_specifier name: (type_identifier) @symbol)',
]
class = [
'(struct_specifier name: (type_identifier) @symbol body:(_))',
'(declaration type: (union_specifier name: (type_identifier) @symbol))',
'(class_specifier name: (type_identifier) @symbol)',
]
function = [
'(function_declarator declarator: (identifier) @symbol)',
]
method = [
{ leading = '{scope}::', query = '(function_declarator declarator: (qualified_identifier scope: (_) @scope name: (identifier) @symbol))' },
{ leading = '{scope.1}::{scope.2}::', query = '(function_declarator declarator: (qualified_identifier scope: (_) @scope.1 name: (qualified_identifier scope: (_) @scope.2 name: (identifier) @symbol)))' },
]
[fish]
alias = '(command name: _ @command (#eq? @command "alias") . argument: _ @symbol)'
function = '(function_definition name: _ @symbol)'
[kak]
function = '(define_command name: _ @symbol)'
hook = '(hook_definition name: _ @symbol)'
module = '(provide_module name: _ @symbol)'
mode = '(declare_user_mode name: _ @symbol)'
[nu]
function = [
'(decl_def unquoted_name: _ @symbol)',
'(decl_def quoted_name: (val_string (string_content) @symbol))',
]
[ocaml]
function = [
'''
(value_definition
[
(let_binding pattern: (value_name) @symbol (parameter))
(let_binding
pattern: (value_name) @symbol
body: [(fun_expression) (function_expression)]
)
]
)
''',
'''
(value_definition
[
(let_binding pattern: (parenthesized_operator (_) @symbol) (parameter))
(let_binding
pattern: (parenthesized_operator (_) @symbol)
body: [(fun_expression) (function_expression)]
)
]
)
''',
'(external (value_name) @symbol)'
]
class = '''
[
(class_definition
(class_binding (class_name) @symbol)
)
(class_type_definition
(class_type_binding (class_type_name) @symbol)
)
]
'''
type = '''
(type_definition
(type_binding
name: [
(type_constructor) @symbol
(type_constructor_path (type_constructor) @symbol)
]
)
)
'''
method = '(method_definition (method_name) @symbol)'
impl = '(module_type_path (module_type_name) @symbol)'
module = '(module_definition (module_binding (module_name) @symbol))'
interface = '(module_type_definition (module_type_name) @symbol)'
[rust]
constant = [
'(static_item name: (identifier) @symbol)',
{ leading = '{trait}::', query = '(trait_item name: (type_identifier) @trait body: (declaration_list (const_item name: (identifier) @symbol)))' },
'(const_item name: (identifier) @symbol)',
]
type = [
{ leading = '{trait}::', query = '(trait_item name: (type_identifier) @trait body: (declaration_list (associated_type name: (type_identifier) @symbol)))' },
'(associated_type name: (type_identifier) @symbol)',
'(type_item name: (type_identifier) @symbol)',
]
enum = '(enum_item name: (type_identifier) @symbol)'
variant = {
leading = "{enum}::",
query = """
(enum_item
name: (type_identifier) @enum
body: (enum_variant_list
(enum_variant
name: (identifier) @symbol)))"""
}
struct = '(struct_item name: (type_identifier) @symbol)'
trait = '(trait_item name: (type_identifier) @symbol)'
method = [
{ leading = '{type}::', query = '(impl_item type: _ @type body: (declaration_list (function_item name: (identifier) @symbol)))' },
{ leading = '{trait}::', query = '(trait_item name: (type_identifier) @trait body: (declaration_list (function_item name: (identifier) @symbol)))' },
{ leading = '{trait}::', query = '(trait_item name: (type_identifier) @trait body: (declaration_list (function_signature_item name: (identifier) @symbol)))' },
'(declaration_list (function_item name: (identifier) @symbol))',
'(declaration_list (function_signature_item name: (identifier) @symbol))',
]
function = '(function_item name: (identifier) @symbol)'
macro = '(macro_definition name: (identifier) @symbol)'
impl = [
'(impl_item !trait type: _ @symbol)',
{ leading = '{trait} for ', query = '(impl_item trait: _ @trait type: _ @symbol)' },
'(attribute (scoped_identifier) @attr (#eq? @attr "extend::ext") arguments: (_ "=" _ @symbol ")"))',
]
[odin]
struct = '(struct_declaration (identifier) @symbol "::")'
method = '(procedure_declaration (identifier) @symbol)'
type = '(const_declaration (identifier) @symbol)'
module = '(import_declaration alias: (identifier) @symbol)'
[python]
method = [
{ leading = '{class}.', query = '(class_definition name: _ @class body: (block (decorated_definition definition: (function_definition name: _ @symbol))))' },
{ leading = '{class}.', query = '(class_definition name: _ @class body: (block (function_definition name: _ @symbol)))' }
]
function = '(function_definition name: (identifier) @symbol)'
class = '(class_definition name: (identifier) @symbol)'
[go]
[typescript]
type = [
'(type_alias_declaration name: _ @symbol)',
{ leading = '{type}.', query = '(type_alias_declaration name: (type_identifier) @type value: (object_type (method_signature name: (property_identifier) @symbol)))' },
]
interface = [
'(interface_declaration name: _ @symbol)',
{ leading = '{interface}.', query = '(interface_declaration name: (type_identifier) @interface body: (interface_body (method_signature name: (property_identifier) @symbol)))' },
'(method_signature name: (property_identifier) @symbol)',
]
class = '(class_declaration name: (type_identifier) @symbol)'
method = [
{ leading = '{class}.', query = '(class_declaration name: (type_identifier) @class body: (class_body (method_definition name: (property_identifier) @symbol)))' },
'(method_definition name: (property_identifier) @symbol)',
]
function = [
{ leading = '{class}.', query = '(class_declaration name: (type_identifier) @class body: (class_body (public_field_definition name: (property_identifier) @symbol value: (arrow_function))))' },
'(function_declaration name: (identifier) @symbol)',
'(program (lexical_declaration (variable_declarator name: (identifier) @symbol value: (arrow_function))))',
'(program (export_statement (lexical_declaration (variable_declarator name: (identifier) @symbol value: (arrow_function)))))',
]
field = [
{ leading = '{class}.', query = '(class_declaration name: (type_identifier) @class body: (class_body (public_field_definition name: (property_identifier) @symbol)))' },
]
constant = '(program (export_statement declaration: (lexical_declaration kind: "const" (variable_declarator name: (identifier) @symbol))))'
[haskell]
type = [
'(type_synomym name: (name) @symbol)',
'(data_type name: (name) @symbol)',
]
function = '(haskell declarations: (declarations (signature name: (variable) @symbol)))'
[json]
constant = '(pair key: (string) @symbol)'
[vine]
module = '(item_mod (ident) @symbol)'
enum = '(item_enum (ident) @symbol)'
struct = '(item_struct (ident) @symbol)'
trait = '(item_trait (ident) @symbol)'
type = '(item_type (ident) @symbol)'
impl = [
{ leading = '{super}::{mod}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_impl (ident)? @symbol (_trait) @symbol)))' },
{ leading = '{mod}::', query = '(item_mod (ident) @mod (item_impl (ident)? @symbol (_trait) @symbol))' },
'(item_impl (ident)? @symbol (_trait) @symbol)',
]
constant = [
{ leading = '{super}::{mod}::{impl}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_impl (ident) @impl (item_const (ident) @symbol))))' },
{ leading = '{super}::{mod}::{trait}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_trait (ident) @trait (item_const (ident) @symbol))))' },
{ leading = '{super}::{mod}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_const (ident) @symbol)))' },
{ leading = '{mod}::{impl}::', query = '(item_mod (ident) @mod (item_impl (ident) @impl (item_const (ident) @symbol)))' },
{ leading = '{mod}::{trait}::', query = '(item_mod (ident) @mod (item_trait (ident) @trait (item_const (ident) @symbol)))' },
{ leading = '{mod}::', query = '(item_mod (ident) @mod (item_const (ident) @symbol))' },
{ leading = '{impl}::', query = '(item_impl (ident) @impl (item_const (ident) @symbol))' },
{ leading = '{trait}::', query = '(item_trait (ident) @trait (item_const (ident) @symbol))' },
'(item_const (ident) @symbol)',
]
method = [
{ leading = '{super}::{mod}::{impl}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_impl (ident) @impl (item_fn "." (ident) @symbol))))' },
{ leading = '{super}::{mod}::{trait}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_trait (ident) @trait (item_fn "." (ident) @symbol))))' },
{ leading = '{super}::{mod}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_fn "." (ident) @symbol)))' },
{ leading = '{mod}::{impl}::', query = '(item_mod (ident) @mod (item_impl (ident) @impl (item_fn "." (ident) @symbol)))' },
{ leading = '{mod}::{trait}::', query = '(item_mod (ident) @mod (item_trait (ident) @trait (item_fn "." (ident) @symbol)))' },
{ leading = '{mod}::', query = '(item_mod (ident) @mod (item_fn "." (ident) @symbol))' },
{ leading = '{impl}::', query = '(item_impl (ident) @impl (item_fn "." (ident) @symbol))' },
{ leading = '{trait}::', query = '(item_trait (ident) @trait (item_fn "." (ident) @symbol))' },
'(item_fn "." (ident) @symbol)',
]
function = [
{ leading = '{super}::{mod}::{impl}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_impl (ident) @impl (item_fn (ident) @symbol))))' },
{ leading = '{super}::{mod}::{trait}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_trait (ident) @trait (item_fn (ident) @symbol))))' },
{ leading = '{super}::{mod}::', query = '(item_mod (ident) @super (item_mod (ident) @mod (item_fn (ident) @symbol)))' },
{ leading = '{mod}::{impl}::', query = '(item_mod (ident) @mod (item_impl (ident) @impl (item_fn (ident) @symbol)))' },
{ leading = '{mod}::{trait}::', query = '(item_mod (ident) @mod (item_trait (ident) @trait (item_fn (ident) @symbol)))' },
{ leading = '{mod}::', query = '(item_mod (ident) @mod (item_fn (ident) @symbol))' },
{ leading = '{impl}::', query = '(item_impl (ident) @impl (item_fn (ident) @symbol))' },
{ leading = '{trait}::', query = '(item_trait (ident) @trait (item_fn (ident) @symbol))' },
'(item_fn (ident) @symbol)',
]