Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

nil error when executing additional text edits #157

@Kazy

Description

@Kazy

When using metals, accepting a completion item can include additionalTextEdits to import the selected item. I'm using the same mapping for <CR> as in the README (i.e. with <Plug>(completion_confirm_completion)). Recently, the feature broke when accepting the completion with the following error:

Error detected while processing CompleteDone Autocommands for "<buffer=1>":
E5108: Error executing lua .../.config/nvim/plugged/completion-nvim/lua/completion.lua:87: attempt to perform arithmetic on upvalue 'lnum' (a nil value)

I traced it back to commit 8aecb23, more precisely here, which changed this

local lnum, _ = unpack(api.nvim_win_get_cursor(0))`

into

local lnum = api.nvim_win_get_cursor(0)[0]

Apparently this isn't equivalent. Reverting back this single line fixes the issue. Sorry for the missing reproduction, let me know if one is necessary. Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions