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

Minor issue for warning diagnostics on .setup({...}) with only one non default field

Open pitoniak32 opened this issue 1 year ago • 1 comments

I am just setting a pre_hook option, to override the default nil. But the lua diagnostics are warning about Missing required fields in type CommentConfig.

The docs mention that this should be merged with the default config, I'm wondering if there needs to be a DTO type that marks those fields as optional for the setup function options so they can be merged without warnings. Im not to familiar with lua types though 😅

Following are the default config for the setup(). If you want to override, just modify the option that you want then it will be merged with the default config. Read :h comment.config for more info.

Screenshot 2024-12-05 at 9 11 52 AM

If this would be a medium difficulty fix I would be willing to make a PR if your are accepting contributions!

pitoniak32 avatar Dec 05 '24 14:12 pitoniak32

If you'd like to ignore this for now, you can add an ignore:

            ---@diagnostic disable-next-line: missing-fields
            require("Comment").setup({
                  ....
           })

purarue avatar Sep 16 '25 05:09 purarue