Anodomani
Anodomani

Reputation: 1

Codelens not showing variable references

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?

Upvotes: 0

Views: 870

Answers (2)

Anodomani
Anodomani

Reputation: 1

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

Upvotes: 0

Squirrelkiller
Squirrelkiller

Reputation: 2814

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.

Upvotes: 0

Related Questions