Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect completion_callback usage example #3905

Open
ArturGulik opened this issue Mar 26, 2024 · 0 comments
Open

Incorrect completion_callback usage example #3905

ArturGulik opened this issue Mar 26, 2024 · 0 comments

Comments

@ArturGulik
Copy link

The documentation here provides the following example of defining the completion_callback argument:

local function my_completion_cb(command_before_comp, cur_pos_before_comp, ncomp)
    return command_before_comp.."foo", cur_pos_before_comp+3, 1
end

This example is not working. The length operator is used on the third output of the callback, here: prompt.lua:840. This suggests that the third output argument should be an array.

If I'm right the example should rather look like this:

local function my_completion_cb(command_before_comp, cur_pos_before_comp, ncomp)
    local completion = command_before_comp.."foo"
    return completion, cur_pos_before_comp+3, {completion}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant