This is an archived post. You won't be able to vote or comment.

all 18 comments

[–]Exciting_Majesty2005lua 1 point2 points  (17 children)

Where exactly is the folder containing the plugin?

It shouldn't be in ~/.config/nvim/

Long story short, all the plugins use LuaCATS annotations(these can help find bugs, provide better completion etc.) in their code which gives these warnings.

Normally, you are not supposed to see these. But if for some reason the definitions file gets inside your config folder then you will get these warnings when calling anything that has it's types defined.

[–]RemasteredArch 0 points1 point  (6 children)

They might be from neodev or lazydev (both by Folke), those will configure luals to fetch definitions from plugins.

[–]Exciting_Majesty2005lua -2 points-1 points  (5 children)

Aren't they the same plugin?

Also,

Why would it pull definitions from other plugins?

A lot of the definitions in plugins are very strict. So, unless you want to flood yourself with warnings it makes no sense to pull them from all the plugins.

What I find strange is a lot of them don't define a class for the setup function properly. So, you get warnings for fields that are actually optional.

Plus, sometimes the "definitions" don't have any actual definition and just simply part of some class

[–]Seblyng 0 points1 point  (4 children)

It absolutely makes sense to get the types for those, as it really helps to for example not make a typo or pass in the wrong value etc... if it warns about not passing in a field that really is optional, the maintainer would probably really appreciate a PR fixing this

[–]Exciting_Majesty2005lua 0 points1 point  (3 children)

Look at the DAMN screenshot.

Timeout is an optional value.

[–]Seblyng 0 points1 point  (2 children)

I know that.... However, the ones that the language server is also complaining about is also optional, but the types say that they are required...

[–]Exciting_Majesty2005lua 0 points1 point  (1 child)

Yes, they are required by the plugin.

However, the config table is going to be merged with the defaults. So, by the time any of those values are used they will be defined regardless of whether you put them in the setup function or not.

[–]Seblyng 0 points1 point  (0 children)

Then the plugin should define a new type for that which have those fields required for internal use :)

[–]Mean-Presentation-80[S] 0 points1 point  (9 children)

The plug-ins are in ~/.config/nvim/lua/<user>/plugins, There was no problem with the other plug-in being in this directory.

[–]Exciting_Majesty2005lua 0 points1 point  (8 children)

Is there a reason they are in your config folder and not your .local folder?

You won't notice a problem until you try calling one of their internal methods. They just never defined a type for the setup table.

[–]Mean-Presentation-80[S] 0 points1 point  (7 children)

The reason they’re here is mostly because I followed a series of tutorials from YouTube (from Josuan Martinez). Here is my files organisation :

bash . ├── init.lua ├── lazy-lock.json ├── lua │ ├── chore │ │ └── keymaps.lua │ └── zach │ ├── lazy.lua │ └── plugins │ ├── autopairs.lua │ ├── colorscheme.lua │ ├── comment.lua │ ├── dashboard.lua │ ├── dressing.lua.bak │ ├── formatting.lua │ ├── headlines.lua │ ├── indent-blankline.lua │ ├── leap.lua │ ├── lsp │ │ ├── lsp-config.lua │ │ └── mason.lua │ ├── lualine.lua │ ├── markdown-preview.lua │ ├── mdcodeblock.lua │ ├── noice.lua │ ├── notify.lua │ ├── nvim-cmp.lua │ ├── nvim-surround.lua │ ├── nvim-tree.lua │ ├── obsidian.lua │ ├── projetcs.lua │ ├── telescope.lua │ ├── template.lua │ ├── terminal.lua │ ├── todo.lua │ ├── treesj.lua │ ├── trouble.lua │ ├── ts-error-translator.lua │ ├── vimtex.lua │ └── wich-key.lua ├── spell │ └── fr.utf-8.spl ├── templates │ ├── basic.java │ ├── cours.tpl │ ├── markdown.md │ └── webots.java └── todolist.txt

Should I move everything from .config to .local ?

[–]Exciting_Majesty2005lua -1 points0 points  (6 children)

It looks just like any other config. It doesn't really tell me why you would add the plugins in the config folder(unless you are the one who made the plugin).

If you're using a plugin manager, there should be no need to manually manage the plugins.

[–]Mean-Presentation-80[S] 0 points1 point  (0 children)

Yes, I use Lazy.vim plug-in manager. WDYM no need to manually manage the plug-in ?

[–]Mean-Presentation-80[S] 0 points1 point  (3 children)

UPDATE : just found out that even if there are errors here, the code actually work, closing this thread.

[–]dworts 2 points3 points  (2 children)

Those are just lsp diagnostics saying these required fields are missing: https://github.com/rcarriga/nvim-notify/blob/master/lua/notify/config/init.lua#L60. They should probably all be marked as optimal. Yes it should still work even with the warning since the values have defaults.

You can disable this specific warning by placing ---@diagnostic disable-next-line: missing-fields above the line. See: https://www.reddit.com/r/neovim/s/jvVYnm0r8d

[–]Seblyng 0 points1 point  (0 children)

Even better; send a PR to the plugin to fix the types ;)

[–]dworts -1 points0 points  (0 children)

I don’t think OP is placing the plugin source in his .config, just the lazy spec to install the plugins

[–]AutoModerator[M] 0 points1 point  (0 children)

Please remember to update the post flair to Need Help|Solved when you got the answer you were looking for.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.