Author Topic: How to go to type definition of an 'auto' in C++?  (Read 320 times)

rowbearto

  • Senior Community Member
  • Posts: 2162
  • Hero Points: 132
How to go to type definition of an 'auto' in C++?
« on: January 12, 2022, 09:23:03 pm »
Lets say I have the below code in C++:

Code: [Select]
class FuncReturnType
{
}

FuncReturnType function()
{
...
}

auto var = function()

// I want to go put my cursor in 'var' below and do something similar to push-tag that takes
// me to the definition of the type of 'var' - i.e. it takes me to 'class FuncReturnType'
newfunction(var, xxx)

I would like to go to the definition of the type that 'var' is.

Is there something similar to 'push-tag' that will take me to the definition of the type of 'var' instead of where 'var' is defined?

See my comment above newfunction() in the code above for more clarity.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3604
  • Hero Points: 480
Re: How to go to type definition of an 'auto' in C++?
« Reply #1 on: January 12, 2022, 10:07:43 pm »
There isn't, but it is a really good idea.  I am going to add an FR for this for the next release (and get to work on it soon).

A couple bits that are already there:
  • Ctrl+Alt+,   (symbol-info-help) -- shows comments and evaluates return type (showing "Evaluated type: ..." after comments.  You can do this for most symbols.
  • Preview Tool Window -- "Document > <language> Options... > Context Tagging" has an option for the preview tool window to show the evaluated type for the symbol under the cursor (again right after the comments)
  • Mouse over symbol info help -- again there is an option under "Document > <language> Options... > Context Tagging" to show the evaluated return type for the symbol under the mouse.
  • Ctrl+Dot (push-tag) -- sometimes what you need is pretty close under your finger tips, just jump to var, then jump to it's type, etc.
  • Dot -- similar example, type "." after var, and you get Auto-list members, cursor down, pick one from the list, then click the green arrow on its comments to jump to the definition.

rowbearto

  • Senior Community Member
  • Posts: 2162
  • Hero Points: 132
Re: How to go to type definition of an 'auto' in C++?
« Reply #2 on: January 12, 2022, 10:18:47 pm »
Thanks so much Dennis!