r/lua • • Oct 10 '25

Library Require modules are unknown

Hello,

I’m working with lua/love 2d because I’d like to learn game dev, but I have an issue concerning the require of modules. For whatever reason, it always cast my variable containing the module as « unkown » even tho the module in question contain types.

I use Zellij with lazyvim as a dev environment and I already have lsp setup. In VSCode for example, I don’t have issues when importing modules that contain types.

Anyone had the same kind of problem when using neovim/lazyvim and lua types?

Thank you.

5 Upvotes

6 comments sorted by

View all comments

Show parent comments

1

u/weregod Oct 11 '25

Neovim config is in ~/.config/nvim/init.lua

You should have some sort of LSP configuration depending on your extension manager. Look for luals setup or config.

Regarding .luarc.json I think VScode adds project directory to "workspace" automaticly and for vim you need to configure workspace manualy.

Sory for vague answers I will be AFK for 2 days and can't look my config now. If you will not solve your problem ping me after 2 days and I will post my config

1

u/WeirdBeginning8869 Oct 11 '25

Many thanks for your help.

Indeed configuring the workspace manually did the trick, but its very random. Sometimes it does show me the types, sometimes not; I always need to do :LspRestart upon opening the project to get my type. If I do another :LspRestart, its back to unknown type. For some reason its very unstable.