refactor: rename @type capture to @symbol

This commit is contained in:
Steven Arcangeli 2023-10-31 16:49:22 -07:00
parent eb301a4763
commit 23a739c0ac
38 changed files with 202 additions and 197 deletions

View file

@ -6,7 +6,12 @@ local M = {}
---@param path string ---@param path string
---@return nil|TSNode ---@return nil|TSNode
local function node_from_match(match, path) local function node_from_match(match, path)
return ((match or {})[path] or {}).node local ret = ((match or {})[path] or {}).node
if path == "symbol" and not ret then
-- Backwards compatibility for old @type capture
ret = ((match or {}).type or {}).node
end
return ret
end end
local get_node_text = vim.treesitter.get_node_text local get_node_text = vim.treesitter.get_node_text
@ -164,7 +169,7 @@ M.help = {
-- We need to get _all_ word nodes -- We need to get _all_ word nodes
local pieces = {} local pieces = {}
local node = match.name.node local node = match.name.node
if vim.startswith(match.type.node:type(), "h") then if vim.startswith(node_from_match(match, "symbol"):type(), "h") then
while node and node:type() == "word" do while node and node:type() == "word" do
local row, col = node:start() local row, col = node:start()
table.insert(pieces, 1, get_node_text(node, bufnr)) table.insert(pieces, 1, get_node_text(node, bufnr))
@ -303,7 +308,7 @@ M.cpp = {
if item.kind ~= "Function" then if item.kind ~= "Function" then
return return
end end
local parent = node_from_match(match, "type") local parent = node_from_match(match, "symbol")
local stop_types = { "function_definition", "declaration", "field_declaration" } local stop_types = { "function_definition", "declaration", "field_declaration" }
while parent and not vim.tbl_contains(stop_types, parent:type()) do while parent and not vim.tbl_contains(stop_types, parent:type()) do
parent = parent:parent() parent = parent:parent()
@ -349,7 +354,7 @@ M.typescript = {
M.latex = { M.latex = {
postprocess = function(bufnr, item, match) postprocess = function(bufnr, item, match)
local type_node = assert(node_from_match(match, "type")) local type_node = assert(node_from_match(match, "symbol"))
local base_type = type_node:type() local base_type = type_node:type()
if base_type == "title_declaration" then if base_type == "title_declaration" then
item.name = "Title: " .. item.name item.name = "Title: " .. item.name

View file

@ -6,9 +6,9 @@ local util = require("aerial.backends.util")
local M = {} local M = {}
-- Custom capture groups: -- Custom capture groups:
-- type: Used to determine the SymbolKind (via language_kind_map) -- symbol: Used to determine to unique node that represents the symbol
-- name (optional): The text of this node will be used in the display -- name (optional): The text of this node will be used in the display
-- start (optional): The location of the start of this symbol (default @type) -- start (optional): The location of the start of this symbol (default @symbol)
-- end (optional): The location of the end of this symbol (default @start) -- end (optional): The location of the end of this symbol (default @start)
M.is_supported = function(bufnr) M.is_supported = function(bufnr)
@ -81,15 +81,15 @@ M.fetch_symbols_sync = function(bufnr)
local name_match = match.name or {} local name_match = match.name or {}
local selection_match = match.selection or {} local selection_match = match.selection or {}
local type_node = (match.type or {}).node local symbol_node = (match.symbol or match.type or {}).node
-- The location capture groups are optional. We default to the -- The location capture groups are optional. We default to the
-- location of the @type capture -- location of the @symbol capture
local start_node = (match.start or {}).node or type_node local start_node = (match.start or {}).node or symbol_node
local end_node = (match["end"] or {}).node or start_node local end_node = (match["end"] or {}).node or start_node
local parent_item, parent_node, level = ext.get_parent(stack, match, type_node) local parent_item, parent_node, level = ext.get_parent(stack, match, symbol_node)
-- Sometimes our queries will match the same node twice. -- Sometimes our queries will match the same node twice.
-- Detect that (type_node == parent_node), and skip dupes. -- Detect that (symbol_node == parent_node), and skip dupes.
if not type_node or type_node == parent_node then if not symbol_node or symbol_node == parent_node then
goto continue goto continue
end end
local kind = match.kind local kind = match.kind
@ -152,7 +152,7 @@ M.fetch_symbols_sync = function(bufnr)
else else
table.insert(items, item) table.insert(items, item)
end end
table.insert(stack, { node = type_node, item = item }) table.insert(stack, { node = symbol_node, item = item })
::continue:: ::continue::
end end

View file

@ -1,4 +1,4 @@
(function_definition (function_definition
name: (word) @name name: (word) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol

View file

@ -1,11 +1,11 @@
(type_definition (type_definition
type: (enum_specifier) @type type: (enum_specifier) @symbol
declarator: (type_identifier) @name declarator: (type_identifier) @name
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @start ) @start
(type_definition (type_definition
type: (struct_specifier) @type type: (struct_specifier) @symbol
declarator: (type_identifier) @name declarator: (type_identifier) @name
(#set! "kind" "Struct") (#set! "kind" "Struct")
) @start ) @start
@ -13,10 +13,10 @@
( (
(declaration) @root @start (declaration) @root @start
. .
(function_definition) @type @end (function_definition) @symbol @end
(#set! "kind" "Function") (#set! "kind" "Function")
) )
(function_definition (function_definition
(#set! "kind" "Function") (#set! "kind" "Function")
) @type @root ) @symbol @root

View file

@ -1,41 +1,41 @@
(interface_declaration (interface_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(class_declaration (class_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(struct_declaration (struct_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Struct") (#set! "kind" "Struct")
) @type ) @symbol
(method_declaration (method_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(enum_declaration (enum_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @type ) @symbol
(constructor_declaration (constructor_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Constructor") (#set! "kind" "Constructor")
) @type ) @symbol
(property_declaration (property_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Property") (#set! "kind" "Property")
) @type ) @symbol
(field_declaration (field_declaration
(variable_declaration (variable_declaration
(variable_declarator (variable_declarator
(identifier) @name)) (identifier) @name))
(#set! "kind" "Field") (#set! "kind" "Field")
) @type ) @symbol

View file

@ -2,12 +2,12 @@
name: (type_identifier) @name name: (type_identifier) @name
body: (field_declaration_list) body: (field_declaration_list)
(#set! "kind" "Struct") (#set! "kind" "Struct")
) @type ) @symbol
(declaration (declaration
(struct_specifier (struct_specifier
body: (field_declaration_list) body: (field_declaration_list)
) @type ) @symbol
declarator: (identifier) @name declarator: (identifier) @name
(#set! "kind" "Struct") (#set! "kind" "Struct")
) )
@ -15,14 +15,14 @@
(function_declarator (function_declarator
declarator: (_) @name declarator: (_) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(enum_specifier (enum_specifier
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @type ) @symbol
(class_specifier (class_specifier
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol

View file

@ -1,12 +1,12 @@
(class_definition (class_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(constructor_signature (constructor_signature
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Constructor") (#set! "kind" "Constructor")
) @type ) @symbol
( (
(method_signature (method_signature
@ -17,7 +17,7 @@
(setter_signature (setter_signature
name: (identifier) @name) name: (identifier) @name)
] ]
) @type ) @symbol
. .
(function_body) @end (function_body) @end
(#set! "kind" "Method") (#set! "kind" "Method")
@ -25,7 +25,7 @@
( (
(function_signature (function_signature
name: (identifier) @name) @type name: (identifier) @name) @symbol
. .
(function_body) @end (function_body) @end
(#set! "kind" "Function") (#set! "kind" "Function")
@ -34,4 +34,4 @@
(enum_declaration (enum_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @type ) @symbol

View file

@ -2,7 +2,7 @@
target: (identifier) @identifier (#any-of? @identifier "defmodule" "defprotocol") target: (identifier) @identifier (#any-of? @identifier "defmodule" "defprotocol")
(arguments) @name (arguments) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(call (call
target: (identifier) @identifier (#eq? @identifier "defimpl") target: (identifier) @identifier (#eq? @identifier "defimpl")
@ -13,7 +13,7 @@
value: (alias) @name)) value: (alias) @name))
) )
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(call (call
target: (identifier) @identifier (#any-of? @identifier "def" "defp" "defguard" "defmacro" "defmacrop") target: (identifier) @identifier (#any-of? @identifier "def" "defp" "defguard" "defmacro" "defmacrop")
@ -23,7 +23,7 @@
((identifier) @name) ((identifier) @name)
]) ])
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(unary_operator (unary_operator
operator: "@" operator: "@"
@ -33,7 +33,7 @@
(call target: (identifier) @name) (call target: (identifier) @name)
(binary_operator left: (call target: (identifier) @name)) (binary_operator left: (call target: (identifier) @name))
])) ]))
@type @symbol
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
@ -42,20 +42,20 @@
operand: (call operand: (call
target: (identifier) @identifier (#eq? @identifier "module_attribute") target: (identifier) @identifier (#eq? @identifier "module_attribute")
(arguments) @name (arguments) @name
) @type ) @symbol
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
(unary_operator (unary_operator
operator: "@" operator: "@"
operand: (call target: (identifier) @name (#not-any-of? @name "module_attribute" "callback" "spec" "doc" "moduledoc")) @type operand: (call target: (identifier) @name (#not-any-of? @name "module_attribute" "callback" "spec" "doc" "moduledoc")) @symbol
(#set! "kind" "Constant") (#set! "kind" "Constant")
) @start ) @start
(do_block (do_block
(call (call
target: (identifier) @identifier (#eq? @identifier "defstruct")) @type target: (identifier) @identifier (#eq? @identifier "defstruct")) @symbol
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
@ -64,12 +64,12 @@
target: (identifier) @identifier (#any-of? @identifier "describe" "test") target: (identifier) @identifier (#any-of? @identifier "describe" "test")
(arguments [(string (quoted_content) @name)]) (arguments [(string (quoted_content) @name)])
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
; exunit test setup ; exunit test setup
(do_block (do_block
(call (call
target: (identifier) @identifier @name (#eq? @identifier "setup")) @type target: (identifier) @identifier @name (#eq? @identifier "setup")) @symbol
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol

View file

@ -1,19 +1,19 @@
(function_declaration (function_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(type_declaration (type_declaration
(type_spec (type_spec
name: (type_identifier) @name name: (type_identifier) @name
type: (struct_type) @type) type: (struct_type) @symbol)
(#set! "kind" "Struct") (#set! "kind" "Struct")
) @start ) @start
(type_declaration (type_declaration
(type_spec (type_spec
name: (type_identifier) @name name: (type_identifier) @name
type: (interface_type) @type) type: (interface_type) @symbol)
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @start ) @start
@ -21,4 +21,4 @@
receiver: (_) @receiver receiver: (_) @receiver
name: (field_identifier) @name name: (field_identifier) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol

View file

@ -4,15 +4,15 @@
(word)+ @name @start (word)+ @name @start
(tag) (tag)
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(h2 (h2
(word)+ @name @start (word)+ @name @start
(tag) (tag)
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(tag (tag
text: (word) @name text: (word) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol

View file

@ -1,6 +1,6 @@
((doctype) @name ((doctype) @name
(#set! "kind" "Module") (#set! "kind" "Module")
) @type ) @symbol
(_ (_
[ [
@ -8,8 +8,8 @@
(self_closing_tag (tag_name) @name) (self_closing_tag (tag_name) @name)
] ]
(#set! "kind" "Struct") (#set! "kind" "Struct")
) @type ) @symbol
(attribute (attribute_name) @name (attribute (attribute_name) @name
(#set! "kind" "Field") (#set! "kind" "Field")
) @type ) @symbol

View file

@ -1,30 +1,30 @@
(interface_declaration (interface_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(method_declaration (method_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(constructor_declaration (constructor_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Constructor") (#set! "kind" "Constructor")
) @type ) @symbol
(class_declaration (class_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(enum_declaration (enum_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @type ) @symbol
(field_declaration (field_declaration
declarator: (variable_declarator declarator: (variable_declarator
name: (identifier) @name) name: (identifier) @name)
(#set! "kind" "Field") (#set! "kind" "Field")
) @type ) @symbol

View file

@ -1,34 +1,34 @@
(class_declaration (class_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(function_declaration (function_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(generator_function_declaration (generator_function_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(method_definition (method_definition
name: (property_identifier) @name name: (property_identifier) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(field_definition (field_definition
property: (property_identifier) @name property: (property_identifier) @name
value: (arrow_function) value: (arrow_function)
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
; const fn = () => {} ; const fn = () => {}
(lexical_declaration (lexical_declaration
(variable_declarator (variable_declarator
name: (identifier) @name name: (identifier) @name
value: [(arrow_function) (function) (generator_function)] @type value: [(arrow_function) (function) (generator_function)] @symbol
) )
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
@ -40,7 +40,7 @@
(string (string
(string_fragment) @name @string))? (string_fragment) @name @string))?
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
; test.skip("this test") ; test.skip("this test")
(call_expression (call_expression
@ -52,7 +52,7 @@
(string (string
(string_fragment) @name @string))? (string_fragment) @name @string))?
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
; describe.each([])("Test suite") ; describe.each([])("Test suite")
(call_expression (call_expression
@ -66,4 +66,4 @@
(string (string
(string_fragment) @name @string))? (string_fragment) @name @string))?
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol

View file

@ -1,6 +1,6 @@
(pair (pair
key: (string key: (string
(string_content) @name) (string_content) @name)
value: (object) @type value: (object) @symbol
(#set! "kind" "Class") (#set! "kind" "Class")
) @start ) @start

View file

@ -1,49 +1,49 @@
(module_definition (module_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Module") (#set! "kind" "Module")
) @type ) @symbol
(function_definition (function_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(function_definition (function_definition
name: (field_expression name: (field_expression
value: (_) value: (_)
(identifier)) @name (identifier)) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(short_function_definition (short_function_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(short_function_definition (short_function_definition
name: (field_expression name: (field_expression
value: (_) value: (_)
(identifier)) @name (identifier)) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(abstract_definition (abstract_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(struct_definition (struct_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(const_statement (const_statement
(assignment (assignment
. (identifier) @name) . (identifier) @name)
(#set! "kind" "Constant") (#set! "kind" "Constant")
) @type ) @symbol
(macro_definition (macro_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol

View file

@ -1,32 +1,32 @@
(section (section
text: [(curly_group (text) @name) (_)] @name text: [(curly_group (text) @name) (_)] @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(subsection (subsection
text: [(curly_group (text) @name) (_)] @name text: [(curly_group (text) @name) (_)] @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(subsubsection (subsubsection
text: [(curly_group (text) @name) (_)] @name text: [(curly_group (text) @name) (_)] @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(generic_environment (generic_environment
begin: (begin begin: (begin
name: [(curly_group_text text: (text) @name) (_)] @name name: [(curly_group_text text: (text) @name) (_)] @name
) )
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(new_command_definition (new_command_definition
declaration: [(curly_group_command_name command: (command_name) @name) (_)] @name declaration: [(curly_group_command_name command: (command_name) @name) (_)] @name
(#set! "kind" "Operator") (#set! "kind" "Operator")
) @type ) @symbol
(title_declaration (title_declaration
text: [(curly_group (text) @name) (_)] @name text: [(curly_group (text) @name) (_)] @name
(#set! "kind" "Field") (#set! "kind" "Field")
) @type ) @symbol
(author_declaration (author_declaration
authors: [(curly_group_author_list (author) @name) (_)] @name authors: [(curly_group_author_list (author) @name) (_)] @name
(#set! "kind" "Field") (#set! "kind" "Field")
) @type ) @symbol

View file

@ -1,14 +1,14 @@
(function_declaration (function_declaration
name: [(identifier) (dot_index_expression) (method_index_expression)] @name name: [(identifier) (dot_index_expression) (method_index_expression)] @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(variable_declaration (variable_declaration
(assignment_statement (assignment_statement
(variable_list (variable_list
name: [(identifier) (dot_index_expression)] @name) name: [(identifier) (dot_index_expression)] @name)
(expression_list (expression_list
value: (function_definition) @type)) value: (function_definition) @symbol))
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
@ -16,13 +16,13 @@
(variable_list (variable_list
name: [(identifier) (dot_index_expression) (bracket_index_expression)] @name) name: [(identifier) (dot_index_expression) (bracket_index_expression)] @name)
(expression_list (expression_list
value: (function_definition) @type) value: (function_definition) @symbol)
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
(field (field
name: (identifier) @name name: (identifier) @name
value: (function_definition) @type value: (function_definition) @symbol
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
@ -30,7 +30,7 @@
name: (identifier) @method @name (#any-of? @method "describe" "it" "before_each" "after_each" "setup" "teardown") name: (identifier) @method @name (#any-of? @method "describe" "it" "before_each" "after_each" "setup" "teardown")
arguments: (arguments arguments: (arguments
(string)? @name (string)? @name
(function_definition) @type) (function_definition) @symbol)
(#set! "kind" "Function") (#set! "kind" "Function")
) @start @selection ) @start @selection
@ -41,6 +41,6 @@
) )
arguments: (arguments arguments: (arguments
(string)? @name (string)? @name
(function_definition) @type) (function_definition) @symbol)
(#set! "kind" "Function") (#set! "kind" "Function")
) @start @selection ) @start @selection

View file

@ -1,4 +1,4 @@
(rule (rule
(targets) @name (targets) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol

View file

@ -2,10 +2,10 @@
[(atx_h1_marker) (atx_h2_marker) (atx_h3_marker) (atx_h4_marker) (atx_h5_marker) (atx_h6_marker)] @level [(atx_h1_marker) (atx_h2_marker) (atx_h3_marker) (atx_h4_marker) (atx_h5_marker) (atx_h6_marker)] @level
heading_content: (_) @name heading_content: (_) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(setext_heading (setext_heading
heading_content: (_) @name heading_content: (_) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
[(setext_h1_underline) (setext_h2_underline)] @level [(setext_h1_underline) (setext_h2_underline)] @level
) @type ) @symbol

View file

@ -1,36 +1,36 @@
;; Headings ;; Headings
((heading1 ((heading1
(heading1_prefix) (heading1_prefix)
title: (paragraph_segment) @name) @type title: (paragraph_segment) @name) @symbol
(#set! "kind" "Interface") (#set! "kind" "Interface")
) )
((heading2 ((heading2
(heading2_prefix) (heading2_prefix)
title: (paragraph_segment) @name) @type title: (paragraph_segment) @name) @symbol
(#set! "kind" "Interface") (#set! "kind" "Interface")
) )
((heading3 ((heading3
(heading3_prefix) (heading3_prefix)
title: (paragraph_segment) @name) @type title: (paragraph_segment) @name) @symbol
(#set! "kind" "Interface") (#set! "kind" "Interface")
) )
((heading4 ((heading4
(heading4_prefix) (heading4_prefix)
title: (paragraph_segment) @name) @type title: (paragraph_segment) @name) @symbol
(#set! "kind" "Interface") (#set! "kind" "Interface")
) )
((heading5 ((heading5
(heading5_prefix) (heading5_prefix)
title: (paragraph_segment) @name) @type title: (paragraph_segment) @name) @symbol
(#set! "kind" "Interface") (#set! "kind" "Interface")
) )
((heading6 ((heading6
(heading6_prefix) (heading6_prefix)
title: (paragraph_segment) @name) @type title: (paragraph_segment) @name) @symbol
(#set! "kind" "Interface") (#set! "kind" "Interface")
) )

View file

@ -1,7 +1,7 @@
(disassembly_section_label (disassembly_section_label
(identifier) @name (identifier) @name
(#set! "kind" "Interface")) @type (#set! "kind" "Interface")) @symbol
(disassembly_section (disassembly_section
(identifier) @name (identifier) @name
(#set! "kind" "Function")) @type (#set! "kind" "Function")) @symbol

View file

@ -2,4 +2,4 @@
(headline (headline
item: (item) @name) item: (item) @name)
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol

View file

@ -1,12 +1,12 @@
(function_definition (function_definition
name: (name) @name name: (name) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(expression_statement (expression_statement
(assignment_expression (assignment_expression
left: (variable_name) @name left: (variable_name) @name
right: (anonymous_function_creation_expression) @type right: (anonymous_function_creation_expression) @symbol
) )
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
@ -14,19 +14,19 @@
(class_declaration (class_declaration
name: (name) @name name: (name) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(method_declaration (method_declaration
name: (name) @name name: (name) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(interface_declaration (interface_declaration
name: (name) @name name: (name) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(trait_declaration (trait_declaration
name: (name) @name name: (name) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol

View file

@ -1,9 +1,9 @@
(message (message
(message_name) @name (message_name) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(enum (enum
(enum_name) @name (enum_name) @name
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @type ) @symbol

View file

@ -1,14 +1,14 @@
(function_definition (function_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(class_definition (class_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(assignment (assignment
left: (_) @name left: (_) @name
(#set! "kind" "Variable") (#set! "kind" "Variable")
) @type ) @symbol

View file

@ -1,4 +1,4 @@
(section (section
(title) @name (title) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol

View file

@ -1,12 +1,12 @@
(class (class
name: [(constant) (scope_resolution)] @name name: [(constant) (scope_resolution)] @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(method (method
name: (_) @name name: (_) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(call (call
(identifier) @scope_switch (identifier) @scope_switch
@ -17,7 +17,7 @@
name: (_) @name name: (_) @name
(#set! "kind" "Method") (#set! "kind" "Method")
(#set! "scope" "private") (#set! "scope" "private")
) @type ) @symbol
) )
) )
@ -34,7 +34,7 @@
name: (_) @name name: (_) @name
(#set! "kind" "Method") (#set! "kind" "Method")
(#set! "scope" "private") (#set! "scope" "private")
) @type ) @symbol
) )
(singleton_method (singleton_method
@ -42,17 +42,17 @@
(["." "::"] @separator)? (["." "::"] @separator)?
name: [(operator) (identifier)] @name name: [(operator) (identifier)] @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(singleton_class (singleton_class
value: (_) @name value: (_) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(module (module
name: [(constant) (scope_resolution)] @name name: [(constant) (scope_resolution)] @name
(#set! "kind" "Module") (#set! "kind" "Module")
) @type ) @symbol
; For Rspec, Rake, and Shoulda ; For Rspec, Rake, and Shoulda
(call (call
@ -70,4 +70,4 @@
(call) @name (call) @name
])? ])?
(#set! "kind" "Method") (#set! "kind" "Method")
) @type @selection ) @symbol @selection

View file

@ -1,42 +1,42 @@
(mod_item (mod_item
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Module") (#set! "kind" "Module")
) @type ) @symbol
(enum_item (enum_item
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @type ) @symbol
(struct_item (struct_item
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Struct") (#set! "kind" "Struct")
) @type ) @symbol
(function_item (function_item
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(function_signature_item (function_signature_item
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(trait_item (trait_item
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(impl_item (impl_item
trait: (type_identifier)? @trait trait: (type_identifier)? @trait
type: (type_identifier) @rust_type type: (type_identifier) @rust_type
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(impl_item (impl_item
trait: (type_identifier)? @trait trait: (type_identifier)? @trait
type: (generic_type type: (generic_type
type: (type_identifier) @rust_type) type: (type_identifier) @rust_type)
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol

View file

@ -1,24 +1,24 @@
(trait_definition (trait_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(object_definition (object_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(class_definition (class_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(function_declaration (function_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(function_definition (function_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol

View file

@ -1,19 +1,19 @@
(function_definition (function_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(class_definition (class_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(assignment (assignment
left: (_) @name left: (_) @name
(#set! "kind" "Variable") (#set! "kind" "Variable")
) @type ) @symbol
(rule_definition (rule_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol

View file

@ -1,68 +1,68 @@
(contract_declaration (contract_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(contract_declaration (_ (contract_declaration (_
(function_definition (function_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type)) ) @symbol))
(contract_declaration (_ (contract_declaration (_
(modifier_definition (modifier_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type)) ) @symbol))
(library_declaration (_ (library_declaration (_
(function_definition (function_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type)) ) @symbol))
(interface_declaration (interface_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(interface_declaration (_ (interface_declaration (_
(function_definition (function_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type)) ) @symbol))
(source_file (source_file
(function_definition (function_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type) ) @symbol)
(library_declaration (library_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Module") (#set! "kind" "Module")
) @type ) @symbol
(enum_declaration (enum_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @type ) @symbol
(event_definition (event_definition
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Event") (#set! "kind" "Event")
) @type ) @symbol
(struct_declaration (struct_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Struct") (#set! "kind" "Struct")
) @type ) @symbol
(constructor_definition (constructor_definition
("constructor") @name ("constructor") @name
(#set! "kind" "Constructor") (#set! "kind" "Constructor")
) @type ) @symbol
(state_variable_declaration (state_variable_declaration
name: (identifier) @name @type name: (identifier) @name @symbol
(#set! "kind" "Field")) (#set! "kind" "Field"))

View file

@ -1,14 +1,14 @@
(function_statement (function_statement
name: [(identifier)] @name name: [(identifier)] @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(var_declaration (var_declaration
(var_declarators (var_declarators
(var (var
name: (identifier) @name)) name: (identifier) @name))
(expressions (expressions
(anon_function) @type) (anon_function) @symbol)
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
@ -19,11 +19,11 @@
(identifier) (identifier)
(identifier) @name))) (identifier) @name)))
(expressions (expressions
(anon_function) @type) (anon_function) @symbol)
(#set! "kind" "Function") (#set! "kind" "Function")
) @start ) @start
(function_statement (function_statement
name: (function_name) @name name: (function_name) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol

View file

@ -1,48 +1,48 @@
(function_signature (function_signature
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(function_declaration (function_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(generator_function_declaration (generator_function_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(interface_declaration (interface_declaration
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(class_declaration (class_declaration
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(method_definition (method_definition
name: (property_identifier) @name name: (property_identifier) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(public_field_definition (public_field_definition
name: (property_identifier) @name name: (property_identifier) @name
value: (arrow_function) value: (arrow_function)
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(type_alias_declaration (type_alias_declaration
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Variable") (#set! "kind" "Variable")
) @type ) @symbol
(lexical_declaration (lexical_declaration
(variable_declarator (variable_declarator
name: (identifier) @name name: (identifier) @name
value: (_) @var_type) @type value: (_) @var_type) @symbol
(#set! "kind" "Variable") (#set! "kind" "Variable")
) @start ) @start
@ -53,7 +53,7 @@
(string (string
(string_fragment) @name @string))? (string_fragment) @name @string))?
(#set! "kind" "Function") (#set! "kind" "Function")
) @type @selection ) @symbol @selection
; test.skip("this test") ; test.skip("this test")
(call_expression (call_expression
@ -65,7 +65,7 @@
(string (string
(string_fragment) @name @string))? (string_fragment) @name @string))?
(#set! "kind" "Function") (#set! "kind" "Function")
) @type @selection ) @symbol @selection
; describe.each([])("Test suite") ; describe.each([])("Test suite")
(call_expression (call_expression
@ -79,4 +79,4 @@
(string (string
(string_fragment) @name @string))? (string_fragment) @name @string))?
(#set! "kind" "Function") (#set! "kind" "Function")
) @type @selection ) @symbol @selection

View file

@ -1,48 +1,48 @@
(function_signature (function_signature
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(function_declaration (function_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(generator_function_declaration (generator_function_declaration
name: (identifier) @name name: (identifier) @name
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol
(interface_declaration (interface_declaration
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(class_declaration (class_declaration
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(method_definition (method_definition
name: (property_identifier) @name name: (property_identifier) @name
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(public_field_definition (public_field_definition
name: (property_identifier) @name name: (property_identifier) @name
value: (arrow_function) value: (arrow_function)
(#set! "kind" "Method") (#set! "kind" "Method")
) @type ) @symbol
(type_alias_declaration (type_alias_declaration
name: (type_identifier) @name name: (type_identifier) @name
(#set! "kind" "Variable") (#set! "kind" "Variable")
) @type ) @symbol
(lexical_declaration (lexical_declaration
(variable_declarator (variable_declarator
name: (identifier) @name name: (identifier) @name
value: (_) @var_type) @type value: (_) @var_type) @symbol
(#set! "kind" "Variable") (#set! "kind" "Variable")
) @start ) @start
@ -53,7 +53,7 @@
(string (string
(string_fragment) @name @string))? (string_fragment) @name @string))?
(#set! "kind" "Function") (#set! "kind" "Function")
) @type @selection ) @symbol @selection
; test.skip("this test") ; test.skip("this test")
(call_expression (call_expression
@ -65,7 +65,7 @@
(string (string
(string_fragment) @name @string))? (string_fragment) @name @string))?
(#set! "kind" "Function") (#set! "kind" "Function")
) @type @selection ) @symbol @selection
; describe.each([])("Test suite") ; describe.each([])("Test suite")
(call_expression (call_expression
@ -79,4 +79,4 @@
(string (string
(string_fragment) @name @string))? (string_fragment) @name @string))?
(#set! "kind" "Function") (#set! "kind" "Function")
) @type @selection ) @symbol @selection

View file

@ -2,36 +2,36 @@
(string) @name (string) @name
(#offset! @name 0 1 0 -1) (#offset! @name 0 1 0 -1)
(#set! "kind" "Class") (#set! "kind" "Class")
) @type ) @symbol
(attribute_assignment (attribute_assignment
[(identifier) (qualified_identifier)] @name [(identifier) (qualified_identifier)] @name
(#set! "kind" "Property") (#set! "kind" "Property")
) @type ) @symbol
(attribute_declaration (attribute_declaration
[(identifier) (qualified_identifier)] @name [(identifier) (qualified_identifier)] @name
(#set! "kind" "Property") (#set! "kind" "Property")
) @type ) @symbol
(relationship_assignment (relationship_assignment
[(identifier) (qualified_identifier)] @name [(identifier) (qualified_identifier)] @name
(#set! "kind" "Property") (#set! "kind" "Property")
) @type ) @symbol
(relationship_declaration (relationship_declaration
[(identifier) (qualified_identifier)] @name [(identifier) (qualified_identifier)] @name
(#set! "kind" "Property") (#set! "kind" "Property")
) @type ) @symbol
(variant_set_definition (variant_set_definition
(string) @name (string) @name
(#offset! @name 0 1 0 -1) (#offset! @name 0 1 0 -1)
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @type ) @symbol
(variant (variant
(string) @name (string) @name
(#offset! @name 0 1 0 -1) (#offset! @name 0 1 0 -1)
(#set! "kind" "EnumMember") (#set! "kind" "EnumMember")
) @type ) @symbol

View file

@ -2,4 +2,4 @@
(function_declaration (function_declaration
name: [(identifier) (scoped_identifier)] @name) name: [(identifier) (scoped_identifier)] @name)
(#set! "kind" "Function") (#set! "kind" "Function")
) @type ) @symbol

View file

@ -2,15 +2,15 @@
(word)+ @name @start (word)+ @name @start
(tag) (tag)
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(h2 (h2
(word)+ @name @start (word)+ @name @start
(tag) (tag)
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol
(tag (tag
text: (word) @name text: (word) @name
(#set! "kind" "Interface") (#set! "kind" "Interface")
) @type ) @symbol

View file

@ -1,11 +1,11 @@
(block_mapping_pair (block_mapping_pair
key: (flow_node) @name key: (flow_node) @name
value: (block_node (block_mapping) @type) value: (block_node (block_mapping) @symbol)
(#set! "kind" "Class") (#set! "kind" "Class")
) @start ) @start
(block_mapping_pair (block_mapping_pair
key: (flow_node) @name key: (flow_node) @name
value: (block_node (block_sequence) @type) value: (block_node (block_sequence) @symbol)
(#set! "kind" "Enum") (#set! "kind" "Enum")
) @start ) @start