2023-02-04 07:58:38 -07:00
|
|
|
---@meta
|
|
|
|
|
2023-08-10 06:21:56 -07:00
|
|
|
---@class TSNode: userdata
|
2023-11-29 07:59:36 -07:00
|
|
|
---@field id fun(self: TSNode): string
|
2023-02-26 09:53:33 -07:00
|
|
|
---@field tree fun(self: TSNode): TSTree
|
2023-03-23 04:23:51 -07:00
|
|
|
---@field range fun(self: TSNode, include_bytes: false?): integer, integer, integer, integer
|
|
|
|
---@field range fun(self: TSNode, include_bytes: true): integer, integer, integer, integer, integer, integer
|
2023-02-04 07:58:38 -07:00
|
|
|
---@field start fun(self: TSNode): integer, integer, integer
|
|
|
|
---@field end_ fun(self: TSNode): integer, integer, integer
|
|
|
|
---@field type fun(self: TSNode): string
|
|
|
|
---@field symbol fun(self: TSNode): integer
|
|
|
|
---@field named fun(self: TSNode): boolean
|
|
|
|
---@field missing fun(self: TSNode): boolean
|
2023-02-26 09:53:33 -07:00
|
|
|
---@field extra fun(self: TSNode): boolean
|
2023-02-04 07:58:38 -07:00
|
|
|
---@field child_count fun(self: TSNode): integer
|
|
|
|
---@field named_child_count fun(self: TSNode): integer
|
2023-10-06 00:27:10 -07:00
|
|
|
---@field child fun(self: TSNode, index: integer): TSNode?
|
|
|
|
---@field named_child fun(self: TSNode, index: integer): TSNode?
|
|
|
|
---@field descendant_for_range fun(self: TSNode, start_row: integer, start_col: integer, end_row: integer, end_col: integer): TSNode?
|
|
|
|
---@field named_descendant_for_range fun(self: TSNode, start_row: integer, start_col: integer, end_row: integer, end_col: integer): TSNode?
|
2023-08-09 10:06:42 -07:00
|
|
|
---@field parent fun(self: TSNode): TSNode?
|
|
|
|
---@field next_sibling fun(self: TSNode): TSNode?
|
|
|
|
---@field prev_sibling fun(self: TSNode): TSNode?
|
|
|
|
---@field next_named_sibling fun(self: TSNode): TSNode?
|
|
|
|
---@field prev_named_sibling fun(self: TSNode): TSNode?
|
2023-02-04 07:58:38 -07:00
|
|
|
---@field named_children fun(self: TSNode): TSNode[]
|
2023-02-26 09:53:33 -07:00
|
|
|
---@field has_changes fun(self: TSNode): boolean
|
2023-08-15 23:02:15 -07:00
|
|
|
---@field has_error fun(self: TSNode): boolean
|
|
|
|
---@field sexpr fun(self: TSNode): string
|
2023-02-26 09:53:33 -07:00
|
|
|
---@field equal fun(self: TSNode, other: TSNode): boolean
|
2023-02-04 07:58:38 -07:00
|
|
|
---@field iter_children fun(self: TSNode): fun(): TSNode, string
|
2023-09-15 00:43:48 -07:00
|
|
|
---@field field fun(self: TSNode, name: string): TSNode[]
|
2023-11-29 07:59:36 -07:00
|
|
|
---@field byte_length fun(self: TSNode): integer
|
2023-02-04 07:58:38 -07:00
|
|
|
local TSNode = {}
|
|
|
|
|
|
|
|
---@param query userdata
|
|
|
|
---@param captures true
|
2023-05-11 03:13:32 -07:00
|
|
|
---@param start? integer
|
|
|
|
---@param end_? integer
|
|
|
|
---@param opts? table
|
2023-02-04 07:58:38 -07:00
|
|
|
---@return fun(): integer, TSNode, any
|
2023-05-11 03:13:32 -07:00
|
|
|
function TSNode:_rawquery(query, captures, start, end_, opts) end
|
2023-02-04 07:58:38 -07:00
|
|
|
|
|
|
|
---@param query userdata
|
|
|
|
---@param captures false
|
2023-05-11 03:13:32 -07:00
|
|
|
---@param start? integer
|
|
|
|
---@param end_? integer
|
|
|
|
---@param opts? table
|
2023-02-04 07:58:38 -07:00
|
|
|
---@return fun(): string, any
|
2023-05-11 03:13:32 -07:00
|
|
|
function TSNode:_rawquery(query, captures, start, end_, opts) end
|
2023-02-04 07:58:38 -07:00
|
|
|
|
2023-05-17 03:42:18 -07:00
|
|
|
---@alias TSLoggerCallback fun(logtype: 'parse'|'lex', msg: string)
|
|
|
|
|
2023-02-04 07:58:38 -07:00
|
|
|
---@class TSParser
|
2023-09-17 01:54:30 -07:00
|
|
|
---@field parse fun(self: TSParser, tree: TSTree?, source: integer|string, include_bytes: true): TSTree, Range6[]
|
|
|
|
---@field parse fun(self: TSParser, tree: TSTree?, source: integer|string, include_bytes: false|nil): TSTree, Range4[]
|
2023-02-26 09:53:33 -07:00
|
|
|
---@field reset fun(self: TSParser)
|
2023-03-09 09:09:39 -07:00
|
|
|
---@field included_ranges fun(self: TSParser, include_bytes: boolean?): integer[]
|
2023-08-10 06:21:56 -07:00
|
|
|
---@field set_included_ranges fun(self: TSParser, ranges: (Range6|TSNode)[])
|
2023-02-26 09:53:33 -07:00
|
|
|
---@field set_timeout fun(self: TSParser, timeout: integer)
|
|
|
|
---@field timeout fun(self: TSParser): integer
|
2023-05-17 03:42:18 -07:00
|
|
|
---@field _set_logger fun(self: TSParser, lex: boolean, parse: boolean, cb: TSLoggerCallback)
|
|
|
|
---@field _logger fun(self: TSParser): TSLoggerCallback
|
2023-02-04 07:58:38 -07:00
|
|
|
|
|
|
|
---@class TSTree
|
|
|
|
---@field root fun(self: TSTree): TSNode
|
|
|
|
---@field edit fun(self: TSTree, _: integer, _: integer, _: integer, _: integer, _: integer, _: integer, _: integer, _: integer, _:integer)
|
|
|
|
---@field copy fun(self: TSTree): TSTree
|
2023-08-10 06:21:56 -07:00
|
|
|
---@field included_ranges fun(self: TSTree, include_bytes: true): Range6[]
|
|
|
|
---@field included_ranges fun(self: TSTree, include_bytes: false): Range4[]
|
2023-02-04 07:58:38 -07:00
|
|
|
|
|
|
|
---@return integer
|
|
|
|
vim._ts_get_language_version = function() end
|
|
|
|
|
|
|
|
---@return integer
|
|
|
|
vim._ts_get_minimum_language_version = function() end
|
|
|
|
|
|
|
|
---@param lang string
|
|
|
|
---@return TSParser
|
|
|
|
vim._create_ts_parser = function(lang) end
|