nPcomp
nPcomp

Reputation: 9963

Is there a way or plugin to display the references on top of a method declarations in VS Code?

Is there a way or plugin to display the references on top of a method declarations in VS Code? Something similar to Visual Studio reference display?

Upvotes: 8

Views: 8288

Answers (2)

UniCoder
UniCoder

Reputation: 3233

Screen shot and process below for mac user, but should be somewhat similar to other platform

Go to Code > preferences > setting

and search referencesCodeLens in search then enable like below screenshot.

enter image description here

Once Done you should see the no of reference above the method name

enter image description here

in addition apply below properties in setting to have easy expand collapse base on indentation

{
    "editor.showFoldingControls": "always",
    "editor.folding": true,
    "editor.foldingStrategy": "indentation", 
}

Upvotes: 7

Matt Bierner
Matt Bierner

Reputation: 65533

This feature is called a code lens and must be implemented per-language by extensions.

VS Code's built-in JavaScript and TypeScript extension includes support. To enable this, just set:

  • "javascript.referencesCodeLens.enabled": true
  • "typescript.referencesCodeLens.enabled": true

The C# extension enables references code lenses by default. The setting for this is:

  • "csharp.referencesCodeLens.enabled": true

Upvotes: 16

Related Questions