Weird grayed out variables in VS code?


Has anyone tried this before?


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

Kind regards


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



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 :sweat_smile:

The code is in this branch:

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

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

Any help is appreciated

Kind regards

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

Thanks, I will make a bug report here: Issues · julia-vscode/julia-vscode · GitHub

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 :slight_smile:

Or if someone by chance knows this fix

Kind regards

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

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


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

Julia-VSCode puggin: v1.66.2


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
OS: Linux x64 5.4.0-170-generic snap

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

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.

1 Like

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.


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

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

Kind regards

1 Like