Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go To Definition does not work for local variables or use semantic information #255

Closed
Jackels opened this issue Sep 24, 2016 · 7 comments
Closed
Labels
Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service

Comments

@Jackels
Copy link

Jackels commented Sep 24, 2016

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.

@Jackels
Copy link
Author

Jackels commented Sep 24, 2016

I made a video of it

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

@bobbrow
Copy link
Member

bobbrow commented Apr 24, 2017

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.

@bobbrow bobbrow changed the title Got To Definition does not work consistently Go To Definition does not work consistently May 22, 2017
@bobbrow bobbrow mentioned this issue Jun 13, 2017
@bobbrow bobbrow changed the title Go To Definition does not work consistently Go To Definition does not work for local variables Jul 6, 2017
@bobbrow bobbrow changed the title Go To Definition does not work for local variables Go To Definition does not work for local variables or use semantic information Jan 24, 2018
@JingGuo218
Copy link

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!

@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented Aug 9, 2018

@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.

@sean-mcmanus
Copy link
Collaborator

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.

@windless0530
Copy link

windless0530 commented Dec 20, 2018

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

@sean-mcmanus
Copy link
Collaborator

@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.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

6 participants