# Neovim lsp unused variables bug

**URL:** <https://discourse.julialang.org/t/neovim-lsp-unused-variables-bug/117363>\
**Category:** Tooling\
**Tags:** question, error\
**Created:** [July 22, 2024, 8:09pm UTC](https://discourse.julialang.org/t/neovim-lsp-unused-variables-bug/117363 "2024-07-22T20:09:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pp4bb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pp4bb/32/210833_2.png) [@pp4bb](https://discourse.julialang.org/u/pp4bb)\
**Post date:** [July 22, 2024, 8:09pm UTC](https://discourse.julialang.org/t/neovim-lsp-unused-variables-bug/117363/1 "2024-07-22T20:09:49Z")

</div>

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).

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/7/e7d355d811bd10d5df7db86e5f3c0db41b4ac0c0.png)  
(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)

---

<div class="post-metadata">

**Author:** ![zmorrell](https://avatars.discourse-cdn.com/v4/letter/z/a5b964/32.png) [@zmorrell](https://discourse.julialang.org/u/zmorrell)\
**Post date:** [November 25, 2024, 12:21am UTC](https://discourse.julialang.org/t/neovim-lsp-unused-variables-bug/117363/2 "2024-11-25T00:21:39Z")

</div>

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.
