Written by

Senior Startups and Community Programs Manager at InterSystems Corporation
Question Evgeny Shvarov · Apr 7

Go to Definition or Go to Declaration - what's the difference in VSCode?

To VSCode experts - see the screenshot. When right-click on a method with intentions to proceed to the source code:

I am always confused about what to choose: declaration or definition. What is the difference?

Comments

John Murray · Apr 7

IIRC, you'd use `Go to Definition` to get to the method code. According to the Language Server README `Go to Declaration` is relevant for variables that are declared as method arguments, or listed in the PublicList of the method, or are declared with #Dim

0
Evgeny Shvarov  Apr 7 to John Murray

Thanks for the clarification, @John Murray ! That's helpful! From a UX standpoint, I'd prefer one menu that "goes to the origin" for both cases, so I don't do calc everytime 'if it is a method, then definition if a variable, then declaration'.

Too complex?

0
Brett Saviano  Apr 7 to Evgeny Shvarov

These "Go To" options are built-in to VS Code core. While the action is the same, the concepts are different. VS Code describes a few of them here.

0
Evgeny Shvarov  Apr 7 to Brett Saviano

Thanks, Brett! They are not ideal as we can see :) Me too ;)

0