How do I fix Intellisense from suggesting old and deprecated members

I recently started developing for Unity / C# using Visual Studio Code with the C# extension. This extension provides Intellisense which is great but I am noticing the Intellisense suggestion box contains suggestions for an older API as well as deprecated methods among the other valid suggestions.

e.g. suggesting the rigidbody property on a script when the new API uses GetComponent
or the deprecated static DestroyObject method suggestion when accessing the MonoBehaviour class.

Is there something I am missing with my configuration that would fix Intellisense? I want deprecated/obsolete methods either removed or marked as such and suggestions for the old API to not even be shown (I’m looking at you this.rigidbody).

Also out of curiosity what is the source Intellisense uses to populate the suggestion box?

The short answer is: no. A bit longer answer can be found here and here.

Feel free to create a feedback request and suggest that Unity should mark obsolete / deprecated things additionally with “EditorBrowsable(false)”, at least those things which clearly do not work anymore or clearly are outdated.

There is already a request to remove obsolete things over here. However they most likely won’t remove the obsolete things anytime soon. The main reason is that old code would no longer compile. The reason why Unity keeps the deprecated methods, fields, properties is to display a proper warning in the console. This is only possible when the code actually compiles. Though marking them with “EditorBrowsable” would be nice ^^.