request: how to set up type checking for tests #9
-
Hello, and many thanks for the detailed instructions. I'm new to neovim plugin development and am working in the suggestions into my plugin right now. I especially liked being able to add type checking into my CI workflows! I had no idea this is possible, and I think it will be a huge benefit to me in the long run. In my project, I also use type annotations to (try to) keep the test data in sync. I'm looking for a way to add this to my CI, but seem to be getting lots of issues with my plugin's types not being found. Here's my change: mikavilpas/yazi.nvim@3e7a5dd, which produced https://github.com/mikavilpas/yazi.nvim/actions/runs/9228497829/job/25392627855#step:9:577 I spent about 45 minutes trying to figure this out but had no luck. Also, no other project on github seems to be doing this at the moment, so I was not able to find an existing example either. To be clear, I'm more than willing to fix my project myself. What I'm looking for, if it's okay with you:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hey 👋 Thanks for the nice words 👋 Looking at your workflow file: directories: |
lua
tests ...will run the lua-language-server type checks once on the You should be able to fix this by running the checks in the project root: directories: . And you can provide further configuration via a |
Beta Was this translation helpful? Give feedback.
-
Thanks for the idea. I tried various things out and I think the Currently I've run into issues with the type checking covering the dependencies too despite attempts to ignore them. This results in 10k+ lines of error diagnostics, so there's still a bit of work to do 😄 I'm not sure but my guess is the lua-language-server does not handle ignores correctly in this case, or it's somehow configured to check the code base incorrectly. A simple workaround would be to restructure the CI build so that the dependencies don't have to be placed inside the project. I will see if this is possible in github actions. |
Beta Was this translation helpful? Give feedback.
-
Check out the docs on .luarc.json. The full schema is here. |
Beta Was this translation helpful? Give feedback.
Hey 👋
Thanks for the nice words 👋
Looking at your workflow file:
...will run the lua-language-server type checks once on the
lua
directory, and once on thetests
directory.It can't see your types on the second run, because it sees
tests
as the root, and doesn't look up.You should be able to fix this by running the checks in the project root:
And you can provide further configuration via a
.luarc.json
.