docs(treesitter): number → integer (#22513)

This commit is contained in:
Jaehwang Jung 2023-03-04 22:04:05 +09:00 committed by GitHub
parent 6cab36e5b7
commit 128b82103b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 22 deletions

View File

@ -748,7 +748,7 @@ add_directive({name}, {handler}, {force})
Parameters: ~
• {name} (string) Name of the directive, without leading #
• {handler} function(match:table<string,|TSNode|>, pattern:string,
bufnr:number, predicate:string[], metadata:table)
bufnr:integer, predicate:string[], metadata:table)
• match: see |treesitter-query|
• node-level data are accessible via `match[capture_id]`
@ -765,7 +765,7 @@ add_predicate({name}, {handler}, {force})
Parameters: ~
• {name} (string) Name of the predicate, without leading #
• {handler} function(match:table<string,|TSNode|>, pattern:string,
bufnr:number, predicate:string[])
bufnr:integer, predicate:string[])
• see |vim.treesitter.add_directive()| for argument
meanings
• {force} (boolean|nil)
@ -776,7 +776,7 @@ get_node_text({node}, {source}, {opts})
Parameters: ~
• {node} |TSNode|
• {source} (number|string) Buffer or string from which the {node} is
• {source} (integer|string) Buffer or string from which the {node} is
extracted
• {opts} (table|nil) Optional parameters.
• concat: (boolean) Concatenate result in a string (default
@ -872,8 +872,8 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop})
• {node} |TSNode| under which the search will occur
• {source} (integer|string) Source buffer or string to extract text
from
• {start} (number) Starting line for the search
• {stop} (number) Stopping line for the search (end-exclusive)
• {start} (integer) Starting line for the search
• {stop} (integer) Stopping line for the search (end-exclusive)
• {self}
Return: ~

View File

@ -1,7 +1,7 @@
local api = vim.api
---@class TSPlayground
---@field ns number API namespace
---@field ns integer API namespace
---@field opts table Options table with the following keys:
--- - anon (boolean): If true, display anonymous nodes
--- - lang (boolean): If true, display the language alongside each node
@ -10,14 +10,14 @@ local api = vim.api
local TSPlayground = {}
---
---@class Node
---@field id number Node id
---@field id integer Node id
---@field text string Node text
---@field named boolean True if this is a named (non-anonymous) node
---@field depth number Depth of the node within the tree
---@field lnum number Beginning line number of this node in the source buffer
---@field col number Beginning column number of this node in the source buffer
---@field end_lnum number Final line number of this node in the source buffer
---@field end_col number Final column number of this node in the source buffer
---@field depth integer Depth of the node within the tree
---@field lnum integer Beginning line number of this node in the source buffer
---@field col integer Beginning column number of this node in the source buffer
---@field end_lnum integer Final line number of this node in the source buffer
---@field end_col integer Final column number of this node in the source buffer
---@field lang string Source language of this node
---@field root TSNode
@ -34,7 +34,7 @@ local TSPlayground = {}
--- table maps nodes in the primary tree to root nodes of injected trees.
---
---@param node TSNode Starting node to begin traversal |tsnode|
---@param depth number Current recursion depth
---@param depth integer Current recursion depth
---@param lang string Language of the tree currently being traversed
---@param injections table<integer,Node> Mapping of node ids to root nodes of injected language trees (see
--- explanation above)
@ -153,7 +153,7 @@ end
--- Write the contents of this Playground into {bufnr}.
---
---@param bufnr number Buffer number to write into.
---@param bufnr integer Buffer number to write into.
---@private
function TSPlayground:draw(bufnr)
vim.bo[bufnr].modifiable = true
@ -194,7 +194,7 @@ end
---
--- The node number is dependent on whether or not anonymous nodes are displayed.
---
---@param i number Node number to get
---@param i integer Node number to get
---@return Node
---@private
function TSPlayground:get(i)
@ -206,7 +206,7 @@ end
---
---@return (fun(): integer, Node) Iterator over all nodes in this Playground
---@return table
---@return number
---@return integer
---@private
function TSPlayground:iter()
return ipairs(self.opts.anon and self.nodes or self.named)

View File

@ -56,7 +56,7 @@ local function add_included_lang(base_langs, lang, ilang)
end
---@private
---@param buf (number)
---@param buf (integer)
---@param range (table)
---@param concat (boolean)
---@returns (string[]|string|nil)
@ -269,7 +269,7 @@ end
--- Gets the text corresponding to a given node
---
---@param node TSNode
---@param source (number|string) Buffer or string from which the {node} is extracted
---@param source (integer|string) Buffer or string from which the {node} is extracted
---@param opts (table|nil) Optional parameters.
--- - concat: (boolean) Concatenate result in a string (default true)
--- - metadata (table) Metadata of a specific capture. This would be
@ -484,7 +484,7 @@ local directive_handlers = {
--- Adds a new predicate to be used in queries
---
---@param name string Name of the predicate, without leading #
---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:number, predicate:string[])
---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:integer, predicate:string[])
--- - see |vim.treesitter.add_directive()| for argument meanings
---@param force boolean|nil
function M.add_predicate(name, handler, force)
@ -503,7 +503,7 @@ end
--- metadata table `metadata[capture_id].key = value`
---
---@param name string Name of the directive, without leading #
---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:number, predicate:string[], metadata:table)
---@param handler function(match:table<string,TSNode>, pattern:string, bufnr:integer, predicate:string[], metadata:table)
--- - match: see |treesitter-query|
--- - node-level data are accessible via `match[capture_id]`
--- - pattern: see |treesitter-query|
@ -644,8 +644,8 @@ end
---
---@param node TSNode under which the search will occur
---@param source (integer|string) Source buffer or string to extract text from
---@param start number Starting line for the search
---@param stop number Stopping line for the search (end-exclusive)
---@param start integer Starting line for the search
---@param stop integer Stopping line for the search (end-exclusive)
---
---@return (fun(): integer, TSNode, TSMetadata): capture id, capture node, metadata
function Query:iter_captures(node, source, start, stop)