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: ~
(table)
Ringbuf:clear({self}) *Ringbuf:clear()*
Ringbuf:clear() *Ringbuf:clear()*
Clear all items.
Ringbuf:peek({self}) *Ringbuf:peek()*
Ringbuf:peek() *Ringbuf:peek()*
Returns the first unread item without removing it
Return: ~
any?|ni
Ringbuf:pop({self}) *Ringbuf:pop()*
Ringbuf:pop() *Ringbuf:pop()*
Removes and returns the first unread item
Return: ~
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.
Parameters: ~
@ -3101,7 +3101,7 @@ filter({f}, {src}, {...}) *vim.iter.filter()*
See also: ~
• |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.
Parameters: ~
@ -3109,7 +3109,7 @@ Iter:all({self}, {pred}) *Iter:all()*
returned from the previous stage in the pipeline as arguments
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.
Parameters: ~
@ -3117,7 +3117,7 @@ Iter:any({self}, {pred}) *Iter:any()*
returned from the previous stage in the pipeline as arguments
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.
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
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
the iterator value.
@ -3160,7 +3160,7 @@ Iter:enumerate({self}) *Iter:enumerate()*
Return: ~
Iter
Iter:filter({self}, {f}) *Iter:filter()*
Iter:filter({f}) *Iter:filter()*
Add a filter step to the iterator pipeline.
Example: >lua
@ -3176,7 +3176,7 @@ Iter:filter({self}, {f}) *Iter:filter()*
Return: ~
Iter
Iter:find({self}, {f}) *Iter:find()*
Iter:find({f}) *Iter:find()*
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
@ -3200,7 +3200,7 @@ Iter:find({self}, {f}) *Iter:find()*
Return: ~
any
Iter:fold({self}, {init}, {f}) *Iter:fold()*
Iter:fold({init}, {f}) *Iter:fold()*
Fold ("reduce") an iterator or table into a single value.
Examples: >lua
@ -3223,7 +3223,7 @@ Iter:fold({self}, {init}, {f}) *Iter:fold()*
Return: ~
any
Iter:last({self}) *Iter:last()*
Iter:last() *Iter:last()*
Return the last item in the iterator.
Drains the iterator.
@ -3242,7 +3242,7 @@ Iter:last({self}) *Iter:last()*
Return: ~
any
Iter:map({self}, {f}) *Iter:map()*
Iter:map({f}) *Iter:map()*
Add a map step to the iterator pipeline.
If the map function returns nil, the value is filtered from the iterator.
@ -3267,7 +3267,7 @@ Iter:map({self}, {f}) *Iter:map()*
Return: ~
Iter
Iter:next({self}) *Iter:next()*
Iter:next() *Iter:next()*
Return the next value from the iterator.
Example: >lua
@ -3284,7 +3284,7 @@ Iter:next({self}) *Iter:next()*
Return: ~
any
Iter:nextback({self}) *Iter:nextback()*
Iter:nextback() *Iter:nextback()*
Return the next value from the end of the iterator.
Only supported for iterators on list-like tables.
@ -3301,7 +3301,7 @@ Iter:nextback({self}) *Iter:nextback()*
Return: ~
any
Iter:nth({self}, {n}) *Iter:nth()*
Iter:nth({n}) *Iter:nth()*
Return the nth value in the iterator.
This function advances the iterator.
@ -3321,7 +3321,7 @@ Iter:nth({self}, {n}) *Iter:nth()*
Return: ~
any
Iter:nthback({self}, {n}) *Iter:nthback()*
Iter:nthback({n}) *Iter:nthback()*
Return the nth value from the end of the iterator.
This function advances the iterator.
@ -3343,7 +3343,7 @@ Iter:nthback({self}, {n}) *Iter:nthback()*
Return: ~
any
Iter:peek({self}) *Iter:peek()*
Iter:peek() *Iter:peek()*
Peek at the next value in the iterator without consuming it.
Only supported for iterators on list-like tables.
@ -3362,7 +3362,7 @@ Iter:peek({self}) *Iter:peek()*
Return: ~
any
Iter:peekback({self}) *Iter:peekback()*
Iter:peekback() *Iter:peekback()*
Return the next value from the end of the iterator without consuming it.
Only supported for iterators on list-like tables.
@ -3381,7 +3381,7 @@ Iter:peekback({self}) *Iter:peekback()*
Return: ~
any
Iter:rev({self}) *Iter:rev()*
Iter:rev() *Iter:rev()*
Reverse an iterator.
Only supported for iterators on list-like tables.
@ -3396,7 +3396,7 @@ Iter:rev({self}) *Iter:rev()*
Return: ~
Iter
Iter:rfind({self}, {f}) *Iter:rfind()*
Iter:rfind({f}) *Iter:rfind()*
Find the first value in the iterator that satisfies the given predicate,
starting from the end.
@ -3420,7 +3420,7 @@ Iter:rfind({self}, {f}) *Iter:rfind()*
See also: ~
• Iter.find
Iter:skip({self}, {n}) *Iter:skip()*
Iter:skip({n}) *Iter:skip()*
Skip values in the iterator.
Example: >lua
@ -3436,7 +3436,7 @@ Iter:skip({self}, {n}) *Iter:skip()*
Return: ~
Iter
Iter:skipback({self}, {n}) *Iter:skipback()*
Iter:skipback({n}) *Iter:skipback()*
Skip values in the iterator starting from the end.
Only supported for iterators on list-like tables.
@ -3456,7 +3456,7 @@ Iter:skipback({self}, {n}) *Iter:skipback()*
Return: ~
Iter
Iter:slice({self}, {first}, {last}) *Iter:slice()*
Iter:slice({first}, {last}) *Iter:slice()*
Slice an iterator, changing its start and end positions.
This is equivalent to :skip(first - 1):skipback(len - last + 1)
@ -3470,7 +3470,7 @@ Iter:slice({self}, {first}, {last}) *Iter:slice()*
Return: ~
Iter
Iter:totable({self}) *Iter:totable()*
Iter:totable() *Iter:totable()*
Collect the iterator into a table.
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: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}
{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
• {start} (integer) Starting line for the search
• {stop} (integer) Stopping line for the search (end-exclusive)
• {self}
Return: ~
(fun(): integer, TSNode, TSMetadata): capture id, capture node,
metadata
*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.
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
traversing too deep into a tree. Requires treesitter >=
0.20.9.
• {self}
Return: ~
(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*
TSHighlighter:destroy({self}) *TSHighlighter:destroy()*
TSHighlighter:destroy() *TSHighlighter:destroy()*
Removes all internal references to the highlighter
Parameters: ~
• {self}
==============================================================================
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
frequent updates.
LanguageTree:children({self}) *LanguageTree:children()*
LanguageTree:children() *LanguageTree:children()*
Returns a map of language to child tree.
Parameters: ~
• {self}
LanguageTree:contains({self}, {range}) *LanguageTree:contains()*
LanguageTree:contains({range}) *LanguageTree:contains()*
Determines whether {range} is contained in the |LanguageTree|.
Parameters: ~
• {range} (table) `{ start_line, start_col, end_line, end_col }`
• {self}
Return: ~
(boolean)
LanguageTree:destroy({self}) *LanguageTree:destroy()*
LanguageTree:destroy() *LanguageTree:destroy()*
Destroys this |LanguageTree| and all its children.
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.
Parameters: ~
• {self}
*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
Parameters: ~
• {fn} fun(tree: LanguageTree, lang: string)
• {include_self} (boolean|nil) Whether to include the invoking tree in
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.
Note: This includes the invoking tree's child trees as well.
Parameters: ~
• {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
Parameters: ~
• {self}
Return: ~
integer[][]
LanguageTree:invalidate({self}, {reload}) *LanguageTree:invalidate()*
LanguageTree:invalidate({reload}) *LanguageTree:invalidate()*
Invalidates this parser and all its children
Parameters: ~
• {reload} (boolean|nil)
• {self}
*LanguageTree:is_valid()*
LanguageTree:is_valid({self}, {exclude_children})
LanguageTree:is_valid({exclude_children}) *LanguageTree:is_valid()*
Determines whether this tree is valid. If the tree is invalid, call `parse()` . This will return the updated tree.
Parameters: ~
• {exclude_children} (boolean|nil)
• {self}
Return: ~
(boolean)
LanguageTree:lang({self}) *LanguageTree:lang()*
LanguageTree:lang() *LanguageTree:lang()*
Gets the language of this tree node.
Parameters: ~
• {self}
*LanguageTree:language_for_range()*
LanguageTree:language_for_range({self}, {range})
LanguageTree:language_for_range({range})
Gets the appropriate language that contains {range}.
Parameters: ~
• {range} (table) `{ start_line, start_col, end_line, end_col }`
• {self}
Return: ~
|LanguageTree| Managing {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}.
Parameters: ~
@ -1182,24 +1158,20 @@ LanguageTree:named_node_for_range({self}, {range}, {opts})
• {opts} (table|nil) Optional keyword arguments:
• ignore_injections boolean Ignore injected languages
(default true)
• {self}
Return: ~
|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
tree represents. This will run the injection query for this language to
determine if any child languages should be created.
Parameters: ~
• {self}
Return: ~
TSTree[]
*LanguageTree:register_cbs()*
LanguageTree:register_cbs({self}, {cbs}, {recursive})
LanguageTree:register_cbs({cbs}, {recursive})
Registers callbacks for the |LanguageTree|.
Parameters: ~
@ -1219,16 +1191,12 @@ LanguageTree:register_cbs({self}, {cbs}, {recursive})
number of the buffer.
• {recursive?} boolean Apply callbacks recursively for all children.
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).
Parameters: ~
• {self}
*LanguageTree:tree_for_range()*
LanguageTree:tree_for_range({self}, {range}, {opts})
LanguageTree:tree_for_range({range}, {opts})
Gets the tree that contains {range}.
Parameters: ~
@ -1236,16 +1204,12 @@ LanguageTree:tree_for_range({self}, {range}, {opts})
• {opts} (table|nil) Optional keyword arguments:
• ignore_injections boolean Ignore injected languages
(default true)
• {self}
Return: ~
TSTree|nil
LanguageTree:trees({self}) *LanguageTree:trees()*
LanguageTree:trees() *LanguageTree:trees()*
Returns all trees this language tree contains. Does not include child
languages.
Parameters: ~
• {self}
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 xml.dom import minidom
Element = minidom.Element
MIN_PYTHON_VERSION = (3, 6)
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
def fmt_node_as_vimhelp(parent, width=text_width - indentation, indent='',
def fmt_node_as_vimhelp(parent: Element, width=text_width - indentation, indent='',
fmt_vimhelp=False):
"""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
out = ''
for name, desc in m.items():
if name == 'self':
continue
name = '{}'.format('{{{}}}'.format(name).ljust(max_name_len))
out += '{}{}\n'.format(name, desc)
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):
split_return = return_type.split(' ')
name = f'{split_return[1]}:{name}'
params = [x for x in params if x[1] != 'self']
c_args = []
for param_type, param_name in params: