skip to Main Content

I updated to Visual Studio Code 1.81 and after doing so Codelens has stopped showing references to variables within code. It still operates normally for Classes, Methods, seemingly everything except for variables. [EDIT] It also displays references correctly for static variables.

Class shows references in code but variables do not

I tried downgrading to the previous version of VSCode but it did not fix the issue. I also tried resetting my settings but this didn’t fix it. I also attempted to reset Omnisharp as per this post: Visual Studio Code codelens doesn't work on variables but it did not seem to fix it either.

Is there a setting that I am not aware of that affects this?

2

Answers


  1. Chosen as BEST ANSWER

    This issue is the same as stackoverflow.com/q/76850403/11107541 I was able to fix it using the solution provided there. I had to uninstall the C# Dev Kit and Unity extensions and reload Omnisharp. Now things are running as they did before: Correct display of references


  2. As far as I know, Codelens only displays references for classes, methods and properties, but not for fields (properties are secretly methods with a field but don’t tell anyone). Are you sure it displays references for a static field, as opposed to a property?

    As long as I remember (so like, a few years), it’s always been like this:

    Image showing an example class with method, field and property, showing the codelens reference counter above everything except the field.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search