docs(lua): do not render self args

This commit is contained in:
Lewis Russell 2023-07-17 10:39:52 +01:00
parent d0b612f360
commit a54f88ea64
3 changed files with 49 additions and 82 deletions

View File

@ -1888,22 +1888,22 @@ ringbuf({size}) *vim.ringbuf()*
Return: ~ Return: ~
(table) (table)
Ringbuf:clear({self}) *Ringbuf:clear()* Ringbuf:clear() *Ringbuf:clear()*
Clear all items. Clear all items.
Ringbuf:peek({self}) *Ringbuf:peek()* Ringbuf:peek() *Ringbuf:peek()*
Returns the first unread item without removing it Returns the first unread item without removing it
Return: ~ Return: ~
any?|ni any?|ni
Ringbuf:pop({self}) *Ringbuf:pop()* Ringbuf:pop() *Ringbuf:pop()*
Removes and returns the first unread item Removes and returns the first unread item
Return: ~ Return: ~
any?|ni any?|ni
Ringbuf:push({self}, {item}) *Ringbuf:push()* Ringbuf:push({item}) *Ringbuf:push()*
Adds an item, overriding the oldest item if the buffer is full. Adds an item, overriding the oldest item if the buffer is full.
Parameters: ~ Parameters: ~
@ -3101,7 +3101,7 @@ filter({f}, {src}, {...}) *vim.iter.filter()*
See also: ~ See also: ~
• |Iter:filter()| • |Iter:filter()|
Iter:all({self}, {pred}) *Iter:all()* Iter:all({pred}) *Iter:all()*
Return true if all of the items in the iterator match the given predicate. Return true if all of the items in the iterator match the given predicate.
Parameters: ~ Parameters: ~
@ -3109,7 +3109,7 @@ Iter:all({self}, {pred}) *Iter:all()*
returned from the previous stage in the pipeline as arguments returned from the previous stage in the pipeline as arguments
and returns true if the predicate matches. and returns true if the predicate matches.
Iter:any({self}, {pred}) *Iter:any()* Iter:any({pred}) *Iter:any()*
Return true if any of the items in the iterator match the given predicate. Return true if any of the items in the iterator match the given predicate.
Parameters: ~ Parameters: ~
@ -3117,7 +3117,7 @@ Iter:any({self}, {pred}) *Iter:any()*
returned from the previous stage in the pipeline as arguments returned from the previous stage in the pipeline as arguments
and returns true if the predicate matches. and returns true if the predicate matches.
Iter:each({self}, {f}) *Iter:each()* Iter:each({f}) *Iter:each()*
Call a function once for each item in the pipeline. Call a function once for each item in the pipeline.
This is used for functions which have side effects. To modify the values This is used for functions which have side effects. To modify the values
@ -3130,7 +3130,7 @@ Iter:each({self}, {f}) *Iter:each()*
Takes all of the values returned by the previous stage in the Takes all of the values returned by the previous stage in the
pipeline as arguments. pipeline as arguments.
Iter:enumerate({self}) *Iter:enumerate()* Iter:enumerate() *Iter:enumerate()*
Add an iterator stage that returns the current iterator count as well as Add an iterator stage that returns the current iterator count as well as
the iterator value. the iterator value.
@ -3160,7 +3160,7 @@ Iter:enumerate({self}) *Iter:enumerate()*
Return: ~ Return: ~
Iter Iter
Iter:filter({self}, {f}) *Iter:filter()* Iter:filter({f}) *Iter:filter()*
Add a filter step to the iterator pipeline. Add a filter step to the iterator pipeline.
Example: >lua Example: >lua
@ -3176,7 +3176,7 @@ Iter:filter({self}, {f}) *Iter:filter()*
Return: ~ Return: ~
Iter Iter
Iter:find({self}, {f}) *Iter:find()* Iter:find({f}) *Iter:find()*
Find the first value in the iterator that satisfies the given predicate. Find the first value in the iterator that satisfies the given predicate.
Advances the iterator. Returns nil and drains the iterator if no value is Advances the iterator. Returns nil and drains the iterator if no value is
@ -3200,7 +3200,7 @@ Iter:find({self}, {f}) *Iter:find()*
Return: ~ Return: ~
any any
Iter:fold({self}, {init}, {f}) *Iter:fold()* Iter:fold({init}, {f}) *Iter:fold()*
Fold ("reduce") an iterator or table into a single value. Fold ("reduce") an iterator or table into a single value.
Examples: >lua Examples: >lua
@ -3223,7 +3223,7 @@ Iter:fold({self}, {init}, {f}) *Iter:fold()*
Return: ~ Return: ~
any any
Iter:last({self}) *Iter:last()* Iter:last() *Iter:last()*
Return the last item in the iterator. Return the last item in the iterator.
Drains the iterator. Drains the iterator.
@ -3242,7 +3242,7 @@ Iter:last({self}) *Iter:last()*
Return: ~ Return: ~
any any
Iter:map({self}, {f}) *Iter:map()* Iter:map({f}) *Iter:map()*
Add a map step to the iterator pipeline. Add a map step to the iterator pipeline.
If the map function returns nil, the value is filtered from the iterator. If the map function returns nil, the value is filtered from the iterator.
@ -3267,7 +3267,7 @@ Iter:map({self}, {f}) *Iter:map()*
Return: ~ Return: ~
Iter Iter
Iter:next({self}) *Iter:next()* Iter:next() *Iter:next()*
Return the next value from the iterator. Return the next value from the iterator.
Example: >lua Example: >lua
@ -3284,7 +3284,7 @@ Iter:next({self}) *Iter:next()*
Return: ~ Return: ~
any any
Iter:nextback({self}) *Iter:nextback()* Iter:nextback() *Iter:nextback()*
Return the next value from the end of the iterator. Return the next value from the end of the iterator.
Only supported for iterators on list-like tables. Only supported for iterators on list-like tables.
@ -3301,7 +3301,7 @@ Iter:nextback({self}) *Iter:nextback()*
Return: ~ Return: ~
any any
Iter:nth({self}, {n}) *Iter:nth()* Iter:nth({n}) *Iter:nth()*
Return the nth value in the iterator. Return the nth value in the iterator.
This function advances the iterator. This function advances the iterator.
@ -3321,7 +3321,7 @@ Iter:nth({self}, {n}) *Iter:nth()*
Return: ~ Return: ~
any any
Iter:nthback({self}, {n}) *Iter:nthback()* Iter:nthback({n}) *Iter:nthback()*
Return the nth value from the end of the iterator. Return the nth value from the end of the iterator.
This function advances the iterator. This function advances the iterator.
@ -3343,7 +3343,7 @@ Iter:nthback({self}, {n}) *Iter:nthback()*
Return: ~ Return: ~
any any
Iter:peek({self}) *Iter:peek()* Iter:peek() *Iter:peek()*
Peek at the next value in the iterator without consuming it. Peek at the next value in the iterator without consuming it.
Only supported for iterators on list-like tables. Only supported for iterators on list-like tables.
@ -3362,7 +3362,7 @@ Iter:peek({self}) *Iter:peek()*
Return: ~ Return: ~
any any
Iter:peekback({self}) *Iter:peekback()* Iter:peekback() *Iter:peekback()*
Return the next value from the end of the iterator without consuming it. Return the next value from the end of the iterator without consuming it.
Only supported for iterators on list-like tables. Only supported for iterators on list-like tables.
@ -3381,7 +3381,7 @@ Iter:peekback({self}) *Iter:peekback()*
Return: ~ Return: ~
any any
Iter:rev({self}) *Iter:rev()* Iter:rev() *Iter:rev()*
Reverse an iterator. Reverse an iterator.
Only supported for iterators on list-like tables. Only supported for iterators on list-like tables.
@ -3396,7 +3396,7 @@ Iter:rev({self}) *Iter:rev()*
Return: ~ Return: ~
Iter Iter
Iter:rfind({self}, {f}) *Iter:rfind()* Iter:rfind({f}) *Iter:rfind()*
Find the first value in the iterator that satisfies the given predicate, Find the first value in the iterator that satisfies the given predicate,
starting from the end. starting from the end.
@ -3420,7 +3420,7 @@ Iter:rfind({self}, {f}) *Iter:rfind()*
See also: ~ See also: ~
• Iter.find • Iter.find
Iter:skip({self}, {n}) *Iter:skip()* Iter:skip({n}) *Iter:skip()*
Skip values in the iterator. Skip values in the iterator.
Example: >lua Example: >lua
@ -3436,7 +3436,7 @@ Iter:skip({self}, {n}) *Iter:skip()*
Return: ~ Return: ~
Iter Iter
Iter:skipback({self}, {n}) *Iter:skipback()* Iter:skipback({n}) *Iter:skipback()*
Skip values in the iterator starting from the end. Skip values in the iterator starting from the end.
Only supported for iterators on list-like tables. Only supported for iterators on list-like tables.
@ -3456,7 +3456,7 @@ Iter:skipback({self}, {n}) *Iter:skipback()*
Return: ~ Return: ~
Iter Iter
Iter:slice({self}, {first}, {last}) *Iter:slice()* Iter:slice({first}, {last}) *Iter:slice()*
Slice an iterator, changing its start and end positions. Slice an iterator, changing its start and end positions.
This is equivalent to :skip(first - 1):skipback(len - last + 1) This is equivalent to :skip(first - 1):skipback(len - last + 1)
@ -3470,7 +3470,7 @@ Iter:slice({self}, {first}, {last}) *Iter:slice()*
Return: ~ Return: ~
Iter Iter
Iter:totable({self}) *Iter:totable()* Iter:totable() *Iter:totable()*
Collect the iterator into a table. Collect the iterator into a table.
The resulting table depends on the initial source in the iterator The resulting table depends on the initial source in the iterator

View File

@ -947,7 +947,7 @@ parse({lang}, {query}) *vim.treesitter.query.parse()*
Query Parsed query Query Parsed query
*Query:iter_captures()* *Query:iter_captures()*
Query:iter_captures({self}, {node}, {source}, {start}, {stop}) Query:iter_captures({node}, {source}, {start}, {stop})
Iterate over all captures from all matches inside {node} Iterate over all captures from all matches inside {node}
{source} is needed if the query contains predicates; then the caller must {source} is needed if the query contains predicates; then the caller must
@ -976,14 +976,13 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop})
from from
• {start} (integer) Starting line for the search • {start} (integer) Starting line for the search
• {stop} (integer) Stopping line for the search (end-exclusive) • {stop} (integer) Stopping line for the search (end-exclusive)
• {self}
Return: ~ Return: ~
(fun(): integer, TSNode, TSMetadata): capture id, capture node, (fun(): integer, TSNode, TSMetadata): capture id, capture node,
metadata metadata
*Query:iter_matches()* *Query:iter_matches()*
Query:iter_matches({self}, {node}, {source}, {start}, {stop}, {opts}) Query:iter_matches({node}, {source}, {start}, {stop}, {opts})
Iterates the matches of self on a given range. Iterates the matches of self on a given range.
Iterate over all matches within a {node}. The arguments are the same as Iterate over all matches within a {node}. The arguments are the same as
@ -1015,7 +1014,6 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop}, {opts})
start depth for each match. This is used to prevent start depth for each match. This is used to prevent
traversing too deep into a tree. Requires treesitter >= traversing too deep into a tree. Requires treesitter >=
0.20.9. 0.20.9.
• {self}
Return: ~ Return: ~
(fun(): integer, table<integer,TSNode>, table): pattern id, match, (fun(): integer, table<integer,TSNode>, table): pattern id, match,
@ -1036,12 +1034,9 @@ set({lang}, {query_name}, {text}) *vim.treesitter.query.set()*
============================================================================== ==============================================================================
Lua module: vim.treesitter.highlighter *lua-treesitter-highlighter* Lua module: vim.treesitter.highlighter *lua-treesitter-highlighter*
TSHighlighter:destroy({self}) *TSHighlighter:destroy()* TSHighlighter:destroy() *TSHighlighter:destroy()*
Removes all internal references to the highlighter Removes all internal references to the highlighter
Parameters: ~
• {self}
============================================================================== ==============================================================================
Lua module: vim.treesitter.languagetree *lua-treesitter-languagetree* Lua module: vim.treesitter.languagetree *lua-treesitter-languagetree*
@ -1084,97 +1079,78 @@ change callback anyway as they will be very frequent. Rather a plugin that
does any kind of analysis on a tree should use a timer to throttle too does any kind of analysis on a tree should use a timer to throttle too
frequent updates. frequent updates.
LanguageTree:children({self}) *LanguageTree:children()* LanguageTree:children() *LanguageTree:children()*
Returns a map of language to child tree. Returns a map of language to child tree.
Parameters: ~ LanguageTree:contains({range}) *LanguageTree:contains()*
• {self}
LanguageTree:contains({self}, {range}) *LanguageTree:contains()*
Determines whether {range} is contained in the |LanguageTree|. Determines whether {range} is contained in the |LanguageTree|.
Parameters: ~ Parameters: ~
• {range} (table) `{ start_line, start_col, end_line, end_col }` • {range} (table) `{ start_line, start_col, end_line, end_col }`
• {self}
Return: ~ Return: ~
(boolean) (boolean)
LanguageTree:destroy({self}) *LanguageTree:destroy()* LanguageTree:destroy() *LanguageTree:destroy()*
Destroys this |LanguageTree| and all its children. Destroys this |LanguageTree| and all its children.
Any cleanup logic should be performed here. Any cleanup logic should be performed here.
Note: This DOES NOT remove this tree from a parent. Instead, `remove_child` must be called on the parent to remove it. Note: This DOES NOT remove this tree from a parent. Instead, `remove_child` must be called on the parent to remove it.
Parameters: ~
• {self}
*LanguageTree:for_each_child()* *LanguageTree:for_each_child()*
LanguageTree:for_each_child({self}, {fn}, {include_self}) LanguageTree:for_each_child({fn}, {include_self})
Invokes the callback for each |LanguageTree| and its children recursively Invokes the callback for each |LanguageTree| and its children recursively
Parameters: ~ Parameters: ~
• {fn} fun(tree: LanguageTree, lang: string) • {fn} fun(tree: LanguageTree, lang: string)
• {include_self} (boolean|nil) Whether to include the invoking tree in • {include_self} (boolean|nil) Whether to include the invoking tree in
the results the results
• {self}
LanguageTree:for_each_tree({self}, {fn}) *LanguageTree:for_each_tree()* LanguageTree:for_each_tree({fn}) *LanguageTree:for_each_tree()*
Invokes the callback for each |LanguageTree| recursively. Invokes the callback for each |LanguageTree| recursively.
Note: This includes the invoking tree's child trees as well. Note: This includes the invoking tree's child trees as well.
Parameters: ~ Parameters: ~
• {fn} fun(tree: TSTree, ltree: LanguageTree) • {fn} fun(tree: TSTree, ltree: LanguageTree)
• {self}
LanguageTree:included_regions({self}) *LanguageTree:included_regions()* LanguageTree:included_regions() *LanguageTree:included_regions()*
Gets the set of included regions Gets the set of included regions
Parameters: ~
• {self}
Return: ~ Return: ~
integer[][] integer[][]
LanguageTree:invalidate({self}, {reload}) *LanguageTree:invalidate()* LanguageTree:invalidate({reload}) *LanguageTree:invalidate()*
Invalidates this parser and all its children Invalidates this parser and all its children
Parameters: ~ Parameters: ~
• {reload} (boolean|nil) • {reload} (boolean|nil)
• {self}
*LanguageTree:is_valid()* LanguageTree:is_valid({exclude_children}) *LanguageTree:is_valid()*
LanguageTree:is_valid({self}, {exclude_children})
Determines whether this tree is valid. If the tree is invalid, call `parse()` . This will return the updated tree. Determines whether this tree is valid. If the tree is invalid, call `parse()` . This will return the updated tree.
Parameters: ~ Parameters: ~
• {exclude_children} (boolean|nil) • {exclude_children} (boolean|nil)
• {self}
Return: ~ Return: ~
(boolean) (boolean)
LanguageTree:lang({self}) *LanguageTree:lang()* LanguageTree:lang() *LanguageTree:lang()*
Gets the language of this tree node. Gets the language of this tree node.
Parameters: ~
• {self}
*LanguageTree:language_for_range()* *LanguageTree:language_for_range()*
LanguageTree:language_for_range({self}, {range}) LanguageTree:language_for_range({range})
Gets the appropriate language that contains {range}. Gets the appropriate language that contains {range}.
Parameters: ~ Parameters: ~
• {range} (table) `{ start_line, start_col, end_line, end_col }` • {range} (table) `{ start_line, start_col, end_line, end_col }`
• {self}
Return: ~ Return: ~
|LanguageTree| Managing {range} |LanguageTree| Managing {range}
*LanguageTree:named_node_for_range()* *LanguageTree:named_node_for_range()*
LanguageTree:named_node_for_range({self}, {range}, {opts}) LanguageTree:named_node_for_range({range}, {opts})
Gets the smallest named node that contains {range}. Gets the smallest named node that contains {range}.
Parameters: ~ Parameters: ~
@ -1182,24 +1158,20 @@ LanguageTree:named_node_for_range({self}, {range}, {opts})
• {opts} (table|nil) Optional keyword arguments: • {opts} (table|nil) Optional keyword arguments:
• ignore_injections boolean Ignore injected languages • ignore_injections boolean Ignore injected languages
(default true) (default true)
• {self}
Return: ~ Return: ~
|TSNode| | nil Found node |TSNode| | nil Found node
LanguageTree:parse({self}) *LanguageTree:parse()* LanguageTree:parse() *LanguageTree:parse()*
Parses all defined regions using a treesitter parser for the language this Parses all defined regions using a treesitter parser for the language this
tree represents. This will run the injection query for this language to tree represents. This will run the injection query for this language to
determine if any child languages should be created. determine if any child languages should be created.
Parameters: ~
• {self}
Return: ~ Return: ~
TSTree[] TSTree[]
*LanguageTree:register_cbs()* *LanguageTree:register_cbs()*
LanguageTree:register_cbs({self}, {cbs}, {recursive}) LanguageTree:register_cbs({cbs}, {recursive})
Registers callbacks for the |LanguageTree|. Registers callbacks for the |LanguageTree|.
Parameters: ~ Parameters: ~
@ -1219,16 +1191,12 @@ LanguageTree:register_cbs({self}, {cbs}, {recursive})
number of the buffer. number of the buffer.
• {recursive?} boolean Apply callbacks recursively for all children. • {recursive?} boolean Apply callbacks recursively for all children.
Any new children will also inherit the callbacks. Any new children will also inherit the callbacks.
• {self}
LanguageTree:source({self}) *LanguageTree:source()* LanguageTree:source() *LanguageTree:source()*
Returns the source content of the language tree (bufnr or string). Returns the source content of the language tree (bufnr or string).
Parameters: ~
• {self}
*LanguageTree:tree_for_range()* *LanguageTree:tree_for_range()*
LanguageTree:tree_for_range({self}, {range}, {opts}) LanguageTree:tree_for_range({range}, {opts})
Gets the tree that contains {range}. Gets the tree that contains {range}.
Parameters: ~ Parameters: ~
@ -1236,16 +1204,12 @@ LanguageTree:tree_for_range({self}, {range}, {opts})
• {opts} (table|nil) Optional keyword arguments: • {opts} (table|nil) Optional keyword arguments:
• ignore_injections boolean Ignore injected languages • ignore_injections boolean Ignore injected languages
(default true) (default true)
• {self}
Return: ~ Return: ~
TSTree|nil TSTree|nil
LanguageTree:trees({self}) *LanguageTree:trees()* LanguageTree:trees() *LanguageTree:trees()*
Returns all trees this language tree contains. Does not include child Returns all trees this language tree contains. Does not include child
languages. languages.
Parameters: ~
• {self}
vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl:

View File

@ -45,6 +45,7 @@ import logging
from pathlib import Path from pathlib import Path
from xml.dom import minidom from xml.dom import minidom
Element = minidom.Element
MIN_PYTHON_VERSION = (3, 6) MIN_PYTHON_VERSION = (3, 6)
MIN_DOXYGEN_VERSION = (1, 9, 0) MIN_DOXYGEN_VERSION = (1, 9, 0)
@ -720,8 +721,7 @@ def para_as_map(parent, indent='', width=text_width - indentation, fmt_vimhelp=F
return chunks, xrefs return chunks, xrefs
def fmt_node_as_vimhelp(parent: Element, width=text_width - indentation, indent='',
def fmt_node_as_vimhelp(parent, width=text_width - indentation, indent='',
fmt_vimhelp=False): fmt_vimhelp=False):
"""Renders (nested) Doxygen <para> nodes as Vim :help text. """Renders (nested) Doxygen <para> nodes as Vim :help text.
@ -734,6 +734,8 @@ def fmt_node_as_vimhelp(parent, width=text_width - indentation, indent='',
max_name_len = max_name(m.keys()) + 4 max_name_len = max_name(m.keys()) + 4
out = '' out = ''
for name, desc in m.items(): for name, desc in m.items():
if name == 'self':
continue
name = '{}'.format('{{{}}}'.format(name).ljust(max_name_len)) name = '{}'.format('{{{}}}'.format(name).ljust(max_name_len))
out += '{}{}\n'.format(name, desc) out += '{}{}\n'.format(name, desc)
return out.rstrip() return out.rstrip()
@ -851,6 +853,7 @@ def extract_from_xml(filename, target, width, fmt_vimhelp):
and any(x[1] == 'self' for x in params): and any(x[1] == 'self' for x in params):
split_return = return_type.split(' ') split_return = return_type.split(' ')
name = f'{split_return[1]}:{name}' name = f'{split_return[1]}:{name}'
params = [x for x in params if x[1] != 'self']
c_args = [] c_args = []
for param_type, param_name in params: for param_type, param_name in params: