4

I know that in vscode, we can find the definition of variable/function by ctrl+clicking. Ctrl+click also supports that for variables/functions declared inside the libararies we've installed.(e.g. torch, numpy, ..)

In my vscode, the 'go to definition' in my own file is available, but I can't click variables defined in libraries.

I want variables/functions of libraries also searchable by ctrl+clicking. How do I make it also available?

WOOJUNG SON
  • 41
  • 1
  • 2
  • same issue for me, although pylance is installed and the interpreter set correctly (the current answers). My workaround is currently to ctrl+click the library instead (i.e. if the function is `foo.bar.func()` i can not click func or bar, but i can click `foo`. Then that library's init file opens and at the top in vscode the path to it appears. clicking on there gives a dropdown choice for selecting `bar`. in there, finally, I search for `func` – lucidbrot Jun 22 '23 at 12:17

2 Answers2

2

If you install the libraries in your virtual environments, You should change the python interpreter to your virtualenv that you use from bottom right side of the vscode and then alt+click can help you.

S.B
  • 13,077
  • 10
  • 22
  • 49
Ali Esmaeili
  • 153
  • 8
1

This is a function provided by pylance.

You can install pylance extension.

enter image description here

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13