Vscode-cpptools: Go To Definition does not work for local variables or use semantic information

Created on 24 Sep 2016  路  7Comments  路  Source: microsoft/vscode-cpptools

I don't know how else to describe this issue.

In a function I have this code:

real32 WorkSecondsElapsed = Win32GetSecondsElapsed(LastCounter, WorkCounter);

if ( WorkSecondsElapsed < TargetSecondsElapsedPerFrame )
{
  if ( SleepIsGranular )
  {
    real32 SleepMS = 1000.0f * (TargetSecondsElapsedPerFrame - WorkSecondsElapsed );

Now when I press f12 ( or select go to definition in the menu ) on the last instance of 'WorkSecondsElapsed ' nothing happens.

Feature Request Language Service fixed (release pending)

Most helpful comment

0.19.0 implements IntelliSense-based Go to Definition with local variables, but only if the definition exists in the same translation unit. The "out of the TU" case (i.e. non-local variables defined in a different C++ file) is still being worked on and will fall back to the previous behavior: see https://github.com/Microsoft/vscode-cpptools/issues/2536.

All 7 comments

I made a video of it

http://i.imgur.com/iHZO8an.gif

This is currently the expected behavior, but we will be improving it in the future. Currently, when files are scanned, local function variables are ignored. This is to avoid polluting the database with tons of local variables since we don't have semantic IntelliSense wired up yet.

I am greatly looking forward to "IntelliSense" a member mentioned. It is the final puzzle piece that I can finally get rid of SourceInsight!! May I know when will the feature be released? Many thanks!

@JingGuo218 We can try to remember to ping you -- it might take 3-6 months -- it's hard to say with any accuracy.

UPDATE: As of August 27th, 2018 we're starting to work on this.
UPDATE: As of September 27th, 2018 we've shipped the implementation for the "current translation unit" scenarios.

0.19.0 implements IntelliSense-based Go to Definition with local variables, but only if the definition exists in the same translation unit. The "out of the TU" case (i.e. non-local variables defined in a different C++ file) is still being worked on and will fall back to the previous behavior: see https://github.com/Microsoft/vscode-cpptools/issues/2536.

0.19.0 implements IntelliSense-based Go to Definition with local variables, but only if the definition exists in the same translation unit. The "out of the TU" case (i.e. non-local variables defined in a different C++ file) is still being worked on and will fall back to the previous behavior: see #2536.

My version is 0.20.1, and the problem seems still exists.
image

@windless0530 Could you file a new issue with more repro info? I can't tell from your example if it's a local variable or a global variable. Most likely you are falling back to the "Tag Parser" due to missing includes.

Was this page helpful?
0 / 5 - 0 ratings