Skip to content

Optional ---@field #54

@tversteeg

Description

@tversteeg

Sorry for bothering you with all the issues, but I found another one, the fields of the class above a function definition get added to the description of the function below:

---`require("registers").apply_register({...})`
---@class apply_register_options
---@field mode? register_mode How the register should be applied. If `nil` then the mode in which the window is opened is used.
---@field keep_open_until_keypress? boolean If `true`, keep the window open until another key is pressed, only applicable when the mode is `"motion"`.

---Apply the specified register.
---@param options? callback_options|apply_register_options Options for firing the callback.
---@return function callback Function that can be used to pass to configuration options with callbacks.
---@usage [[
---require("registers").setup({
---    bind_keys = {
---        -- Always paste the register when selecting with Enter
---        return_key = require("registers").apply_register({ mode = "paste" }),
---    }
---})
---
---require("registers").setup({
---    bind_keys = {
---        -- When pressing a key of the register, wait for another key press before closing the window
---        registers = require("registers").apply_register({ keep_open_until_keypress = true }),
---    }
---})
---@usage ]]
function registers.apply_register(options)

Gets rendered as:

apply_register_options                                  *apply_register_options*
    `require("registers").apply_register({...})`


registers.apply_register({options?})                  *registers.apply_register*
    @field mode? register_mode How the register should be applied. If `nil` then the mode in which the window is opened is used.
    @field keep_open_until_keypress? boolean If `true`, keep the window open until another key is pressed, only applicable when the mode is `"motion"`.
    Apply the specified register.

    Parameters: ~
        {options?}  (callback_options|apply_register_options)  Options for firing the callback.

    Returns: ~
        {function}  Function that can be used to pass to configuration options with callbacks.

    Usage: ~
        >
            require("registers").setup({
                bind_keys = {
                    -- Always paste the register when selecting with Enter
                    return_key = require("registers").apply_register({ mode = "paste" }),
                }
            })

            require("registers").setup({
                bind_keys = {
                    -- When pressing a key of the register, wait for another key press before closing the window
                    registers = require("registers").apply_register({ keep_open_until_keypress = true }),
                }
            })
        <

This has probably something to do with the parsing of linebreaks?

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions