ref: Update annotations

This commit is contained in:
danymat
2022-02-10 11:33:59 +01:00
parent 4c4411c5c8
commit 6966aa684a
4 changed files with 6 additions and 6 deletions

View File

@@ -140,7 +140,7 @@ neogen.match_commands = helpers.match_commands
--- Get a template for a particular filetype
---@param filetype? string
---@return neogen.TemplateConfig|nil
---@return neogen.TemplateConfig?
neogen.get_template = function(filetype)
local template
local ft_conf = filetype and conf.languages[filetype] or conf.languages[vim.bo.filetype]

View File

@@ -24,7 +24,7 @@ local neogen_template = {
---@class neogen.TemplateConfig see |template_config|
---@field annotation_convention string select which annotation convention to use
---@field use_default_comment boolean Prepend default filetype comment before a annotation
---@field append neogen.TemplateConfig.Append|nil custom placement of the annotation
---@field append? neogen.TemplateConfig.Append custom placement of the annotation
---@field position fun(node: userdata, type: string): number,number Provide an absolute position for the annotation
--- If values are `nil`, use default positioning
---
@@ -32,7 +32,7 @@ local neogen_template = {
---@field child_name string Which child node to use for appending the annotation
---@field fallback string Node to fallback if `child_name` is not found
---@field position "'after'"|"'before'" Place the annotation relative to position with `child_name` or `fallback`
---@field disabled table|nil Disable custom placement for provided types
---@field disabled? table Disable custom placement for provided types
---
--- For example, to customize the placement for a python annotation, we can use `append`, like so:
---
@@ -121,7 +121,7 @@ end
--- Add a custom annotation convention to the template
---@param name string The name of the annotation convention
---@param annotation table The annotation template (see |neogen-annotation|)
---@param default boolean|nil Marks the annotation as default one
---@param default? boolean Marks the annotation as default one
---@tag neogen-template-api.add_custom_annotation()
neogen_template.add_custom_annotation = function(self, name, annotation, default)
if default == true then

View File

@@ -4,7 +4,7 @@ return {
--- Extract the content from each node from data
--- @param _ any self
--- @param data table a list of k,v values where k is the node_type and v a table of nodes
--- @param opts table|nil optional configurations (supported: type = true will get node's type instead of node's text)
--- @param opts? table configurations (supported: type = true will get node's type instead of node's text)
--- @return any result the same table as data but with node texts instead
extract_from_matched = function(_, data, opts)
opts = opts or {}

View File

@@ -3,7 +3,7 @@ return {
--- Get a list of child nodes that match the provided node name
--- @param _ any
--- @param parent userdata the parent's node
--- @param node_type string|nil the node type to search for (if multiple childrens, separate each one with "|")
--- @param node_type? string the node type to search for (if multiple childrens, separate each one with "|")
--- @return table a table of nodes that matched the name
matching_child_nodes = function(_, parent, node_type)
local results = {}