Neovim lsp unused variables bug

Hi everyone, I’m using Neovim and the lsp linter presents a bug that tags all my variables as unused if passed as arguments or in different blocks. If anyone knows how to fix it I would be grateful (or instructions in how to disable those warnings would be appreciated in the worst case).


(unused warning when variable is passed as an argument)

It also happens in the last block of a if/elseif/else conditional.

(Saving the file does not solve the problem for me)

I had a similar issue that I encountered today. After a good deal of trouble-shooting, my issue was caused by having too many files trying to include the file in question.

To put it more clearly, I was developing a package which I will call “Package” which had source files src/Package.jl, src/base.jl, src/file1.jl, and src/file2.jl. In my case, the issue was occurring in src/base.jl.

In the module file (src/Package.jl), I only had calls to import dependencies and include all of my other files. Since this package had started as research code, I had include("base.jl") calls at the top of several files in the module. As far as I can tell, this caused the LSP to try to repeatedly import the package that was being used, making it confused about variable scoping. Once I removed the include call from the other files which were dependent on src/base.jl.

I hope this helps, your mileage may vary.