# Weird grayed out variables in VS code?

**URL:** <https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355>\
**Category:** VS Code\
**Tags:** vscode\
**Created:** [January 28, 2024, 8:44am UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355 "2024-01-28T08:44:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [January 28, 2024, 8:44am UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/1 "2024-01-28T08:44:34Z")

</div>

Hello!

Has anyone tried this before?

![image](https://global.discourse-cdn.com/julialang/original/3X/2/c/2ccf7732500089e6b294c0a80c526290ff7358c8.png)

Some variables are grayed out even though they are evidently used. The code it self runs fine, but what is going on?

Kind regards

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/224680_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [January 28, 2024, 8:55am UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/2 "2024-01-28T08:55:52Z")

</div>

I see this sometimes, the variables go back to normal state when I save the file

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [January 28, 2024, 9:14am UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/3 "2024-01-28T09:14:01Z")

</div>

Thanks!

It is really weird, I restarted my computer, opened VS code and for the first few seconds it looks fine, suddenly Git says 9+ modified files, then that goes away and then the colouring turns back to the picture in the first post (i.e. grayed out)

Haven’t tried this before, so don’t even know where to start 😅

The code is in this branch:

> <https://github.com/AhmedSalih3d/SPHExample/tree/optimize-code-execution/src>
>
> //github.com/AhmedSalih3d/SPHExample/tree/optimize-code-execution/src

And it is only functions in this file which gray out:

> <https://github.com/AhmedSalih3d/SPHExample/blob/optimize-code-execution/src/SimulationEquations.jl>

This is also the only file which does not work with `Revise` properly.

Any help is appreciated

Kind regards

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [January 28, 2024, 10:40am UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/4 "2024-01-28T10:40:00Z")

</div>

> [@Ahmed\_Salih](#):
>
> Any help is appreciated

This seems like just a VS Code bug, no? So I don’t see what could we help you with.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [January 28, 2024, 10:45am UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/5 "2024-01-28T10:45:09Z")

</div>

Thanks, I will make a bug report here: [Issues · julia-vscode/julia-vscode · GitHub](https://github.com/julia-vscode/julia-vscode/issues)

To help me, if someone using VS Code would kindly clone the repo and let me know if his/her version of VS code behaves similarly or not, it would help 🙂

Or if someone by chance knows this fix

Kind regards

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [January 28, 2024, 11:26am UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/6 "2024-01-28T11:26:55Z")

</div>

I cloned your repo, but I was unable to reproduce the problem.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/f/cf8cce57585826e5fe6410bbf025b67aadc62ad5.png)

Perhaps there is a difference in version info. Here is my version info:

**Versions**

```julia
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, haswell)
  Threads: 5 on 8 virtual cores
Environment:
  JULIA_CMDSTAN_HOME = /home/dfish/cmdstan
  JULIA_NUM_THREADS = 4
  JULIA_EDITOR = code

Julia-VSCode puggin: v1.66.2

VSCode: 

Version: 1.85.2
Commit: 8b3775030ed1a69b13e4f4c628c612102e30a681
Date: 2024-01-18T06:40:19.222Z
Electron: 25.9.7
ElectronBuildId: 26354273
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 5.4.0-170-generic snap

```

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [January 28, 2024, 11:42am UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/7 "2024-01-28T11:42:28Z")

</div>

Thanks a ton!

I have checked as well now, and I use the same Julia version 1.10, Julia-VSCode plugin is also v1.66.2 and VSCode version is also 1.85.2.

Maybe it is something really obscure happening, will just give it some time, especially since it is only one file.

Kind regards

---

<div class="post-metadata">

**Author:** ![Christopher\_Fisher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/christopher_fisher/32/26132_2.png) [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Post date:** [January 28, 2024, 11:45am UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/8 "2024-01-28T11:45:11Z")

</div>

No problem!

Another possibility is that another pluggin is interfering with the functioning of the Julia linter. You could test that by systematically disabling other pluggins to see if the problem goes away. In either case, that is annoying and strange, but at least only one file is affected.

---

<div class="post-metadata">

**Author:** ![mnemnion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mnemnion/32/206596_2.png) [@mnemnion](https://discourse.julialang.org/u/mnemnion)\
**Post date:** [January 28, 2024, 4:10pm UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/9 "2024-01-28T16:10:40Z")

</div>

I just want to chime in and say that I’ve seen this behavior as well. It appears to be a cache invalidation bug, where the language server doesn’t immediately or consistently discover that a variable has in fact been used. Things like saving the file, navigating to another file, and restarting VSCode, have a tendency to put things back in the correct state.

It’s a bit annoying but basically harmless.

---

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [January 29, 2024, 4:20pm UTC](https://discourse.julialang.org/t/weird-grayed-out-variables-in-vs-code/109355/10 "2024-01-29T16:20:35Z")

</div>

Yeah, wish there was an easy way to just reset it from scratch, it is bugging me a bit 🙂

I have tried doing what you mention and restart etc., unfortunately no success

Kind regards
