6 ms·
If you use the lua lsp, you can make type annotations which basically work like jsdoc. With those annotations, the lsp will warn you about such issues, there i
by pseudo_meta 2y ago
If you use the lua lsp, you can make type annotations which basically work like jsdoc.
With those annotations, the lsp will warn you about such issues, there is a diagnostic that's called something like `needs-nil-check`.
- arp242 2y agoI really really don't want to do type annotations. I just want to know about: variable = 1 print(varaible) It's been a while since I did Lua, but there's been a few cases where this caused massive confusion. Last I checked I couldn't really find a good way to do that; but like I said: it's been a while.
- edflsafoiewq 2y agoLuacheck will warn about unknown globals.
- pseudo_meta 2y agoI think every lua linter warns about that. So does the Lua LSP, no annotations needed.
- CRConrad 2y agoWell, yeah, you shouldn't name your variables so similarly, that's what's causing he confusion. Idunno, maybe varaible is set to "Let's groove, baby!" ? ;-)
- sureglymop 2y agoThat has been nice (at least for editing neovim configuration files). But what if I am editing anything else? For example, I have then tried to edit Wezterm config files and there are no types. I did find some types someone made online but no idea how to instruct my editor/lsp where these types are or what they are for.
- pseudo_meta 2y agoYeah, it's only for nvim or for your own lua projects. For WezTerm annotations, afaik there is currently only an open issue without much progress: https://github.com/wez/wezterm/issues/3132 https://github.com/wez/wezterm/issues/3132