Kamornik Cola
Kamornik Cola

Reputation: 684

Go to declaration in VS Code(as in Pycharm)

just trying to find correct tool for me to start with Python when tried PyCharm -to learn about possible attributes for some object- used an option : "Go to declaration": enter image description here

which brought me to declaration and i could see the available options : enter image description here

when tried to do the same in VS Code: enter image description here

i'm getting this result : enter image description here

I have two questions : 1) how to go to declaration to see the possible options in VS Code ? 2) Can You advise me some plugin - that can explore the definition and may be bring this Params in auto completion ?

** just to mention i have Python extension installed...: enter image description here

Upvotes: 2

Views: 3086

Answers (2)

niid
niid

Reputation: 518

Usually this means one of two things:

  1. The source file where the definition is is not inside the PYTHONPATH
  2. The definition is in a Cython file.

1 is easy to fix: Either make sure you selected the correct python binary in VS Code or (in case of custom libraries or ones which are outside Python's default library locations) add it to PYTHONPATH manually.

2 usually means there is nothing you can do as the VS Code Python extension currently does not analyze any C extensions.

Upvotes: 0

Mike Lischke
Mike Lischke

Reputation: 53407

To 1) Yes, obviously there is "Go to definition" functionality. Otherwise the menu entry wouldn't make any sense, would it?

If no definition was found that means vscode does not have any information about this part, which can have several reasons (e.g. the source code or at least a typings file for that is not available).

It seems obvious but for completeness let me say: "Go to definition" functionality must be provided by an extension for that language. Hence you need one that generates that info for vscode.

To 2) No, we cannot recommend any software here. This is off-topic for Stackoverflow. Use the extension search in vscode and see what's available. Often there is more than one extension for a given language and you can try out what works best for you.

Upvotes: 1

Related Questions