harrisoncramer / gitlab.nvim

Create, review, and manage Gitlab reources without leaving Neovim
MIT License
247 stars 34 forks source link

Add type annotations to improve development experience #300

Closed jakubbortlik closed 4 months ago

jakubbortlik commented 5 months ago

Feature Description

When working on the plugin, I'm getting a lot of warnings about undefined types, e.g., NuiTree or NuiTree.Node: image @harrisoncramer , do you also get these warnings or I am just missing something? The many warnings make it easier to miss some more relevant problems with the code. In #299, I've added an annotation for RootNode (lua/gitlab/actions/discussions/annotations.lua:137), precisely to get rid of some irrelevant warnings. If there is no better way, I'd suggest to add annotations also for a regular Node and for NuiTree. Or maybe this should be done in the nui.nvim library, I don't know.

harrisoncramer commented 5 months ago

I don't have this problem as my editor imports these annotations from the NUI library. If you're using the built-in LSP for Neovim you may have to tell it to be aware of runtime files. You can see my configuration for the LSP here, specifically check out the settings section:

https://github.com/harrisoncramer/nvim/blob/main/lua/lsp/servers/lua-language-server.lua

jakubbortlik commented 4 months ago

Thanks for the tip, unfortunately, I already have the same settings in my config, I've tried printing out the settings with which the server is being set up and I can see that the path to nui.nvim is included in the workspace. Still, I'm getting all the warnings. I'll have to figure this out on my own I guess, as I'm using (mason-lspconfig)[https://github.com/williamboman/mason-lspconfig.nvim], but I've not reviewed the configuration in a long time, so hopefully I'll find a way how to fix this.