Merge pull request #15191 from vigoux/ts-docs

docs(ts): add documentation for listing fns
This commit is contained in:
Thomas Vigouroux
2021-07-26 18:48:15 +02:00
committed by GitHub
2 changed files with 11 additions and 8 deletions

View File

@@ -433,8 +433,13 @@ get_query_files({lang}, {query_name}, {is_included})
{is_included} Internal parameter, most of the time left {is_included} Internal parameter, most of the time left
as `nil` as `nil`
list_directives() *list_directives()*
Return: ~
The list of supported directives.
list_predicates() *list_predicates()* list_predicates() *list_predicates()*
TODO: Documentation Return: ~
The list of supported predicates.
parse_query({lang}, {query}) *parse_query()* parse_query({lang}, {query}) *parse_query()*
Parse {query} as a string. (If the query is in a file, the Parse {query} as a string. (If the query is in a file, the
@@ -514,11 +519,9 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop})
for id, node in pairs(match) do for id, node in pairs(match) do
local name = query.captures[id] local name = query.captures[id]
-- `node` was captured by the `name` capture in the match -- `node` was captured by the `name` capture in the match
<
> local node_data = metadata[id] -- Node level metadata
local node_data = metadata[id] -- Node level metadata
<
>
... use the info here ... ... use the info here ...
end end
end end

View File

@@ -351,12 +351,12 @@ function M.add_directive(name, handler, force)
directive_handlers[name] = handler directive_handlers[name] = handler
end end
--- Returns the list of currently supported directives --- @return The list of supported directives.
function M.list_directives() function M.list_directives()
return vim.tbl_keys(directive_handlers) return vim.tbl_keys(directive_handlers)
end end
--- Returns the list of currently supported predicates --- @return The list of supported predicates.
function M.list_predicates() function M.list_predicates()
return vim.tbl_keys(predicate_handlers) return vim.tbl_keys(predicate_handlers)
end end