mirror of
https://github.com/stevearc/aerial.nvim
synced 2024-09-08 02:35:44 +02:00
refactor: rename @type capture to @symbol
This commit is contained in:
parent
eb301a4763
commit
23a739c0ac
38 changed files with 202 additions and 197 deletions
|
@ -6,7 +6,12 @@ local M = {}
|
|||
---@param path string
|
||||
---@return nil|TSNode
|
||||
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
|
||||
|
||||
local get_node_text = vim.treesitter.get_node_text
|
||||
|
@ -164,7 +169,7 @@ M.help = {
|
|||
-- We need to get _all_ word nodes
|
||||
local pieces = {}
|
||||
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
|
||||
local row, col = node:start()
|
||||
table.insert(pieces, 1, get_node_text(node, bufnr))
|
||||
|
@ -303,7 +308,7 @@ M.cpp = {
|
|||
if item.kind ~= "Function" then
|
||||
return
|
||||
end
|
||||
local parent = node_from_match(match, "type")
|
||||
local parent = node_from_match(match, "symbol")
|
||||
local stop_types = { "function_definition", "declaration", "field_declaration" }
|
||||
while parent and not vim.tbl_contains(stop_types, parent:type()) do
|
||||
parent = parent:parent()
|
||||
|
@ -349,7 +354,7 @@ M.typescript = {
|
|||
|
||||
M.latex = {
|
||||
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()
|
||||
if base_type == "title_declaration" then
|
||||
item.name = "Title: " .. item.name
|
||||
|
|
|
@ -6,9 +6,9 @@ local util = require("aerial.backends.util")
|
|||
local M = {}
|
||||
|
||||
-- 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
|
||||
-- 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)
|
||||
|
||||
M.is_supported = function(bufnr)
|
||||
|
@ -81,15 +81,15 @@ M.fetch_symbols_sync = function(bufnr)
|
|||
|
||||
local name_match = match.name 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
|
||||
-- location of the @type capture
|
||||
local start_node = (match.start or {}).node or type_node
|
||||
-- location of the @symbol capture
|
||||
local start_node = (match.start or {}).node or symbol_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.
|
||||
-- Detect that (type_node == parent_node), and skip dupes.
|
||||
if not type_node or type_node == parent_node then
|
||||
-- Detect that (symbol_node == parent_node), and skip dupes.
|
||||
if not symbol_node or symbol_node == parent_node then
|
||||
goto continue
|
||||
end
|
||||
local kind = match.kind
|
||||
|
@ -152,7 +152,7 @@ M.fetch_symbols_sync = function(bufnr)
|
|||
else
|
||||
table.insert(items, item)
|
||||
end
|
||||
table.insert(stack, { node = type_node, item = item })
|
||||
table.insert(stack, { node = symbol_node, item = item })
|
||||
|
||||
::continue::
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function_definition
|
||||
name: (word) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
(type_definition
|
||||
type: (enum_specifier) @type
|
||||
type: (enum_specifier) @symbol
|
||||
declarator: (type_identifier) @name
|
||||
(#set! "kind" "Enum")
|
||||
) @start
|
||||
|
||||
(type_definition
|
||||
type: (struct_specifier) @type
|
||||
type: (struct_specifier) @symbol
|
||||
declarator: (type_identifier) @name
|
||||
(#set! "kind" "Struct")
|
||||
) @start
|
||||
|
@ -13,10 +13,10 @@
|
|||
(
|
||||
(declaration) @root @start
|
||||
.
|
||||
(function_definition) @type @end
|
||||
(function_definition) @symbol @end
|
||||
(#set! "kind" "Function")
|
||||
)
|
||||
|
||||
(function_definition
|
||||
(#set! "kind" "Function")
|
||||
) @type @root
|
||||
) @symbol @root
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
(interface_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(struct_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Struct")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Enum")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(constructor_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Constructor")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(property_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Property")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(field_declaration
|
||||
(variable_declaration
|
||||
(variable_declarator
|
||||
(identifier) @name))
|
||||
(#set! "kind" "Field")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
name: (type_identifier) @name
|
||||
body: (field_declaration_list)
|
||||
(#set! "kind" "Struct")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(declaration
|
||||
(struct_specifier
|
||||
body: (field_declaration_list)
|
||||
) @type
|
||||
) @symbol
|
||||
declarator: (identifier) @name
|
||||
(#set! "kind" "Struct")
|
||||
)
|
||||
|
@ -15,14 +15,14 @@
|
|||
(function_declarator
|
||||
declarator: (_) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(enum_specifier
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Enum")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(class_specifier
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
(class_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(constructor_signature
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Constructor")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(
|
||||
(method_signature
|
||||
|
@ -17,7 +17,7 @@
|
|||
(setter_signature
|
||||
name: (identifier) @name)
|
||||
]
|
||||
) @type
|
||||
) @symbol
|
||||
.
|
||||
(function_body) @end
|
||||
(#set! "kind" "Method")
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
(
|
||||
(function_signature
|
||||
name: (identifier) @name) @type
|
||||
name: (identifier) @name) @symbol
|
||||
.
|
||||
(function_body) @end
|
||||
(#set! "kind" "Function")
|
||||
|
@ -34,4 +34,4 @@
|
|||
(enum_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Enum")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
target: (identifier) @identifier (#any-of? @identifier "defmodule" "defprotocol")
|
||||
(arguments) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(call
|
||||
target: (identifier) @identifier (#eq? @identifier "defimpl")
|
||||
|
@ -13,7 +13,7 @@
|
|||
value: (alias) @name))
|
||||
)
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(call
|
||||
target: (identifier) @identifier (#any-of? @identifier "def" "defp" "defguard" "defmacro" "defmacrop")
|
||||
|
@ -23,7 +23,7 @@
|
|||
((identifier) @name)
|
||||
])
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(unary_operator
|
||||
operator: "@"
|
||||
|
@ -33,7 +33,7 @@
|
|||
(call target: (identifier) @name)
|
||||
(binary_operator left: (call target: (identifier) @name))
|
||||
]))
|
||||
@type
|
||||
@symbol
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
||||
|
@ -42,20 +42,20 @@
|
|||
operand: (call
|
||||
target: (identifier) @identifier (#eq? @identifier "module_attribute")
|
||||
(arguments) @name
|
||||
) @type
|
||||
) @symbol
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
||||
(unary_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")
|
||||
) @start
|
||||
|
||||
|
||||
(do_block
|
||||
(call
|
||||
target: (identifier) @identifier (#eq? @identifier "defstruct")) @type
|
||||
target: (identifier) @identifier (#eq? @identifier "defstruct")) @symbol
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
||||
|
@ -64,12 +64,12 @@
|
|||
target: (identifier) @identifier (#any-of? @identifier "describe" "test")
|
||||
(arguments [(string (quoted_content) @name)])
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
; exunit test setup
|
||||
(do_block
|
||||
(call
|
||||
target: (identifier) @identifier @name (#eq? @identifier "setup")) @type
|
||||
target: (identifier) @identifier @name (#eq? @identifier "setup")) @symbol
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
(function_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(type_declaration
|
||||
(type_spec
|
||||
name: (type_identifier) @name
|
||||
type: (struct_type) @type)
|
||||
type: (struct_type) @symbol)
|
||||
(#set! "kind" "Struct")
|
||||
) @start
|
||||
|
||||
(type_declaration
|
||||
(type_spec
|
||||
name: (type_identifier) @name
|
||||
type: (interface_type) @type)
|
||||
type: (interface_type) @symbol)
|
||||
(#set! "kind" "Interface")
|
||||
) @start
|
||||
|
||||
|
@ -21,4 +21,4 @@
|
|||
receiver: (_) @receiver
|
||||
name: (field_identifier) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
(word)+ @name @start
|
||||
(tag)
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(h2
|
||||
(word)+ @name @start
|
||||
(tag)
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(tag
|
||||
text: (word) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
((doctype) @name
|
||||
(#set! "kind" "Module")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(_
|
||||
[
|
||||
|
@ -8,8 +8,8 @@
|
|||
(self_closing_tag (tag_name) @name)
|
||||
]
|
||||
(#set! "kind" "Struct")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(attribute (attribute_name) @name
|
||||
(#set! "kind" "Field")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
(interface_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(constructor_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Constructor")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Enum")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(field_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @name)
|
||||
(#set! "kind" "Field")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
(class_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(generator_function_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(method_definition
|
||||
name: (property_identifier) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(field_definition
|
||||
property: (property_identifier) @name
|
||||
value: (arrow_function)
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
; const fn = () => {}
|
||||
(lexical_declaration
|
||||
(variable_declarator
|
||||
name: (identifier) @name
|
||||
value: [(arrow_function) (function) (generator_function)] @type
|
||||
value: [(arrow_function) (function) (generator_function)] @symbol
|
||||
)
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
@ -40,7 +40,7 @@
|
|||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
; test.skip("this test")
|
||||
(call_expression
|
||||
|
@ -52,7 +52,7 @@
|
|||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
; describe.each([])("Test suite")
|
||||
(call_expression
|
||||
|
@ -66,4 +66,4 @@
|
|||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(pair
|
||||
key: (string
|
||||
(string_content) @name)
|
||||
value: (object) @type
|
||||
value: (object) @symbol
|
||||
(#set! "kind" "Class")
|
||||
) @start
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
(module_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Module")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(function_definition
|
||||
name: (field_expression
|
||||
value: (_)
|
||||
(identifier)) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(short_function_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(short_function_definition
|
||||
name: (field_expression
|
||||
value: (_)
|
||||
(identifier)) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(abstract_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(struct_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(const_statement
|
||||
(assignment
|
||||
. (identifier) @name)
|
||||
(#set! "kind" "Constant")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(macro_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
(section
|
||||
text: [(curly_group (text) @name) (_)] @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
(subsection
|
||||
text: [(curly_group (text) @name) (_)] @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
(subsubsection
|
||||
text: [(curly_group (text) @name) (_)] @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
(generic_environment
|
||||
begin: (begin
|
||||
name: [(curly_group_text text: (text) @name) (_)] @name
|
||||
)
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(new_command_definition
|
||||
declaration: [(curly_group_command_name command: (command_name) @name) (_)] @name
|
||||
(#set! "kind" "Operator")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(title_declaration
|
||||
text: [(curly_group (text) @name) (_)] @name
|
||||
(#set! "kind" "Field")
|
||||
) @type
|
||||
) @symbol
|
||||
(author_declaration
|
||||
authors: [(curly_group_author_list (author) @name) (_)] @name
|
||||
(#set! "kind" "Field")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
(function_declaration
|
||||
name: [(identifier) (dot_index_expression) (method_index_expression)] @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(variable_declaration
|
||||
(assignment_statement
|
||||
(variable_list
|
||||
name: [(identifier) (dot_index_expression)] @name)
|
||||
(expression_list
|
||||
value: (function_definition) @type))
|
||||
value: (function_definition) @symbol))
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
|||
(variable_list
|
||||
name: [(identifier) (dot_index_expression) (bracket_index_expression)] @name)
|
||||
(expression_list
|
||||
value: (function_definition) @type)
|
||||
value: (function_definition) @symbol)
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
||||
(field
|
||||
name: (identifier) @name
|
||||
value: (function_definition) @type
|
||||
value: (function_definition) @symbol
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
name: (identifier) @method @name (#any-of? @method "describe" "it" "before_each" "after_each" "setup" "teardown")
|
||||
arguments: (arguments
|
||||
(string)? @name
|
||||
(function_definition) @type)
|
||||
(function_definition) @symbol)
|
||||
(#set! "kind" "Function")
|
||||
) @start @selection
|
||||
|
||||
|
@ -41,6 +41,6 @@
|
|||
)
|
||||
arguments: (arguments
|
||||
(string)? @name
|
||||
(function_definition) @type)
|
||||
(function_definition) @symbol)
|
||||
(#set! "kind" "Function")
|
||||
) @start @selection
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(rule
|
||||
(targets) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
[(atx_h1_marker) (atx_h2_marker) (atx_h3_marker) (atx_h4_marker) (atx_h5_marker) (atx_h6_marker)] @level
|
||||
heading_content: (_) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(setext_heading
|
||||
heading_content: (_) @name
|
||||
(#set! "kind" "Interface")
|
||||
[(setext_h1_underline) (setext_h2_underline)] @level
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
;; Headings
|
||||
((heading1
|
||||
(heading1_prefix)
|
||||
title: (paragraph_segment) @name) @type
|
||||
title: (paragraph_segment) @name) @symbol
|
||||
(#set! "kind" "Interface")
|
||||
)
|
||||
|
||||
((heading2
|
||||
(heading2_prefix)
|
||||
title: (paragraph_segment) @name) @type
|
||||
title: (paragraph_segment) @name) @symbol
|
||||
(#set! "kind" "Interface")
|
||||
)
|
||||
|
||||
((heading3
|
||||
(heading3_prefix)
|
||||
title: (paragraph_segment) @name) @type
|
||||
title: (paragraph_segment) @name) @symbol
|
||||
(#set! "kind" "Interface")
|
||||
)
|
||||
|
||||
((heading4
|
||||
(heading4_prefix)
|
||||
title: (paragraph_segment) @name) @type
|
||||
title: (paragraph_segment) @name) @symbol
|
||||
(#set! "kind" "Interface")
|
||||
)
|
||||
|
||||
((heading5
|
||||
(heading5_prefix)
|
||||
title: (paragraph_segment) @name) @type
|
||||
title: (paragraph_segment) @name) @symbol
|
||||
(#set! "kind" "Interface")
|
||||
)
|
||||
|
||||
((heading6
|
||||
(heading6_prefix)
|
||||
title: (paragraph_segment) @name) @type
|
||||
title: (paragraph_segment) @name) @symbol
|
||||
(#set! "kind" "Interface")
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(disassembly_section_label
|
||||
(identifier) @name
|
||||
(#set! "kind" "Interface")) @type
|
||||
(#set! "kind" "Interface")) @symbol
|
||||
|
||||
(disassembly_section
|
||||
(identifier) @name
|
||||
(#set! "kind" "Function")) @type
|
||||
(#set! "kind" "Function")) @symbol
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
(headline
|
||||
item: (item) @name)
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
(function_definition
|
||||
name: (name) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(expression_statement
|
||||
(assignment_expression
|
||||
left: (variable_name) @name
|
||||
right: (anonymous_function_creation_expression) @type
|
||||
right: (anonymous_function_creation_expression) @symbol
|
||||
)
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
@ -14,19 +14,19 @@
|
|||
(class_declaration
|
||||
name: (name) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(method_declaration
|
||||
name: (name) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(interface_declaration
|
||||
name: (name) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(trait_declaration
|
||||
name: (name) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
(message
|
||||
(message_name) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(enum
|
||||
(enum_name) @name
|
||||
(#set! "kind" "Enum")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
(function_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(class_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(assignment
|
||||
left: (_) @name
|
||||
(#set! "kind" "Variable")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(section
|
||||
(title) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
(class
|
||||
name: [(constant) (scope_resolution)] @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(method
|
||||
name: (_) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(call
|
||||
(identifier) @scope_switch
|
||||
|
@ -17,7 +17,7 @@
|
|||
name: (_) @name
|
||||
(#set! "kind" "Method")
|
||||
(#set! "scope" "private")
|
||||
) @type
|
||||
) @symbol
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
|||
name: (_) @name
|
||||
(#set! "kind" "Method")
|
||||
(#set! "scope" "private")
|
||||
) @type
|
||||
) @symbol
|
||||
)
|
||||
|
||||
(singleton_method
|
||||
|
@ -42,17 +42,17 @@
|
|||
(["." "::"] @separator)?
|
||||
name: [(operator) (identifier)] @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(singleton_class
|
||||
value: (_) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(module
|
||||
name: [(constant) (scope_resolution)] @name
|
||||
(#set! "kind" "Module")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
; For Rspec, Rake, and Shoulda
|
||||
(call
|
||||
|
@ -70,4 +70,4 @@
|
|||
(call) @name
|
||||
])?
|
||||
(#set! "kind" "Method")
|
||||
) @type @selection
|
||||
) @symbol @selection
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
(mod_item
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Module")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(enum_item
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Enum")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(struct_item
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Struct")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(function_item
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(function_signature_item
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(trait_item
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(impl_item
|
||||
trait: (type_identifier)? @trait
|
||||
type: (type_identifier) @rust_type
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(impl_item
|
||||
trait: (type_identifier)? @trait
|
||||
type: (generic_type
|
||||
type: (type_identifier) @rust_type)
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
(trait_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(object_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(class_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
(function_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(class_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(assignment
|
||||
left: (_) @name
|
||||
(#set! "kind" "Variable")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(rule_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,68 +1,68 @@
|
|||
(contract_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(contract_declaration (_
|
||||
(function_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type))
|
||||
) @symbol))
|
||||
|
||||
(contract_declaration (_
|
||||
(modifier_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type))
|
||||
) @symbol))
|
||||
|
||||
(library_declaration (_
|
||||
(function_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type))
|
||||
) @symbol))
|
||||
|
||||
(interface_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(interface_declaration (_
|
||||
(function_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type))
|
||||
) @symbol))
|
||||
|
||||
(source_file
|
||||
(function_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type)
|
||||
) @symbol)
|
||||
|
||||
(library_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Module")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Enum")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(event_definition
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Event")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(struct_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Struct")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(constructor_definition
|
||||
("constructor") @name
|
||||
(#set! "kind" "Constructor")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(state_variable_declaration
|
||||
name: (identifier) @name @type
|
||||
name: (identifier) @name @symbol
|
||||
(#set! "kind" "Field"))
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
(function_statement
|
||||
name: [(identifier)] @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(var_declaration
|
||||
(var_declarators
|
||||
(var
|
||||
name: (identifier) @name))
|
||||
(expressions
|
||||
(anon_function) @type)
|
||||
(anon_function) @symbol)
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
||||
|
@ -19,11 +19,11 @@
|
|||
(identifier)
|
||||
(identifier) @name)))
|
||||
(expressions
|
||||
(anon_function) @type)
|
||||
(anon_function) @symbol)
|
||||
(#set! "kind" "Function")
|
||||
) @start
|
||||
|
||||
(function_statement
|
||||
name: (function_name) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,48 +1,48 @@
|
|||
(function_signature
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(generator_function_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(interface_declaration
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(class_declaration
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(method_definition
|
||||
name: (property_identifier) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(public_field_definition
|
||||
name: (property_identifier) @name
|
||||
value: (arrow_function)
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(type_alias_declaration
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Variable")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(lexical_declaration
|
||||
(variable_declarator
|
||||
name: (identifier) @name
|
||||
value: (_) @var_type) @type
|
||||
value: (_) @var_type) @symbol
|
||||
(#set! "kind" "Variable")
|
||||
) @start
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
|||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type @selection
|
||||
) @symbol @selection
|
||||
|
||||
; test.skip("this test")
|
||||
(call_expression
|
||||
|
@ -65,7 +65,7 @@
|
|||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type @selection
|
||||
) @symbol @selection
|
||||
|
||||
; describe.each([])("Test suite")
|
||||
(call_expression
|
||||
|
@ -79,4 +79,4 @@
|
|||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type @selection
|
||||
) @symbol @selection
|
||||
|
|
|
@ -1,48 +1,48 @@
|
|||
(function_signature
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(generator_function_declaration
|
||||
name: (identifier) @name
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(interface_declaration
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(class_declaration
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(method_definition
|
||||
name: (property_identifier) @name
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(public_field_definition
|
||||
name: (property_identifier) @name
|
||||
value: (arrow_function)
|
||||
(#set! "kind" "Method")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(type_alias_declaration
|
||||
name: (type_identifier) @name
|
||||
(#set! "kind" "Variable")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(lexical_declaration
|
||||
(variable_declarator
|
||||
name: (identifier) @name
|
||||
value: (_) @var_type) @type
|
||||
value: (_) @var_type) @symbol
|
||||
(#set! "kind" "Variable")
|
||||
) @start
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
|||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type @selection
|
||||
) @symbol @selection
|
||||
|
||||
; test.skip("this test")
|
||||
(call_expression
|
||||
|
@ -65,7 +65,7 @@
|
|||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type @selection
|
||||
) @symbol @selection
|
||||
|
||||
; describe.each([])("Test suite")
|
||||
(call_expression
|
||||
|
@ -79,4 +79,4 @@
|
|||
(string
|
||||
(string_fragment) @name @string))?
|
||||
(#set! "kind" "Function")
|
||||
) @type @selection
|
||||
) @symbol @selection
|
||||
|
|
|
@ -2,36 +2,36 @@
|
|||
(string) @name
|
||||
(#offset! @name 0 1 0 -1)
|
||||
(#set! "kind" "Class")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(attribute_assignment
|
||||
[(identifier) (qualified_identifier)] @name
|
||||
(#set! "kind" "Property")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(attribute_declaration
|
||||
[(identifier) (qualified_identifier)] @name
|
||||
(#set! "kind" "Property")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(relationship_assignment
|
||||
[(identifier) (qualified_identifier)] @name
|
||||
(#set! "kind" "Property")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(relationship_declaration
|
||||
[(identifier) (qualified_identifier)] @name
|
||||
(#set! "kind" "Property")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(variant_set_definition
|
||||
(string) @name
|
||||
(#offset! @name 0 1 0 -1)
|
||||
(#set! "kind" "Enum")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(variant
|
||||
(string) @name
|
||||
(#offset! @name 0 1 0 -1)
|
||||
(#set! "kind" "EnumMember")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
(function_declaration
|
||||
name: [(identifier) (scoped_identifier)] @name)
|
||||
(#set! "kind" "Function")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
(word)+ @name @start
|
||||
(tag)
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(h2
|
||||
(word)+ @name @start
|
||||
(tag)
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
||||
(tag
|
||||
text: (word) @name
|
||||
(#set! "kind" "Interface")
|
||||
) @type
|
||||
) @symbol
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
(block_mapping_pair
|
||||
key: (flow_node) @name
|
||||
value: (block_node (block_mapping) @type)
|
||||
value: (block_node (block_mapping) @symbol)
|
||||
(#set! "kind" "Class")
|
||||
) @start
|
||||
|
||||
(block_mapping_pair
|
||||
key: (flow_node) @name
|
||||
value: (block_node (block_sequence) @type)
|
||||
value: (block_node (block_sequence) @symbol)
|
||||
(#set! "kind" "Enum")
|
||||
) @start
|
||||
|
|
Loading…
Reference in a new issue