FTerm.nvim icon indicating copy to clipboard operation
FTerm.nvim copied to clipboard

Avoid linter complaints from missing fields in setup table

Open adigitoleo opened this issue 1 year ago • 2 comments

Hello, thanks for this wonderful implementation. I contributed previously to vim-floaterm and then used my own functions for a while, but now I'm migrating to init.lua and will adopt FTerm instead.

I have a minor grievance: I implemented a version of :Man that uses the FTerm buffer like this:

vim.api.nvim_create_user_command("MAN", function(opts)
    local arg = vim.fn.expand("<cword>")
    if opts.args ~= "" then arg = opts.args end
    require("FTerm").scratch({ cmd = { "man", arg } })
end, { nargs = "?" })

It works, however my lua linter (from the lua-language-server) is complaining about "Missing fields" in the setup table for scratch(). Do you know of a way to avoid this? Thanks

adigitoleo avatar Aug 13 '23 14:08 adigitoleo

It's an issue in the current lua lang server, discussed here

You can put this above your line to disable this warning: require("FTerm").scratch({ cmd = { "man", arg } }) Not perfect but should work

---@diagnostic disable-next-line missing-fields 

xixiaofinland avatar Oct 06 '23 16:10 xixiaofinland

Not it’s not an issue in luals. The annotations are simply wrong, they should be marked as optional.

see https://github.com/hrsh7th/nvim-cmp/pull/1694

tummetott avatar Nov 28 '23 07:11 tummetott