Bug 559917 - Can't find references to variables or constants anymore
Summary: Can't find references to variables or constants anymore
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-07 05:30 EST by Mathieu Dubois CLA
Modified: 2020-09-01 06:03 EDT (History)
2 users (show)

See Also:


Attachments
Illustration of the bug (504.60 KB, image/png)
2020-02-07 05:30 EST, Mathieu Dubois CLA
no flags Details
Minimal working example (362 bytes, application/x-php)
2020-02-07 05:32 EST, Mathieu Dubois CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Dubois CLA 2020-02-07 05:30:13 EST
Created attachment 281733 [details]
Illustration of the bug

In recent versions of eclipse/PDT, trying to find references to variables or constants always return 0 references. For instance in the attached file (example from a real project), there is clearly references to $last_dir yet none is found.

Finding references to functions and classes works.

Access to the definition of all objects (variables, constants, functions and classes) works with the usual shortcut (Ctrl + left click or the contextual menu).

I have tried several versions:
  - Eclipse 2019-09, PDT 7.0.0 installed with the official installer for linux
  - Eclipse 2019-12, PDT 7.0.0 installed with the official installer for linux
  - version provided by Fedora 31 (Eclipse 4.13/2019-09, PDT 6.2.0) but this version seems even more broken (probably a Fedora problem)

It used to work with the version provided by Fedora 30 (Eclipse 4.11/2019-03, PDT 6.2.0).

See also a discussion on PDT forum: https://www.eclipse.org/forums/index.php/m/1821207/.
Comment 1 Mathieu Dubois CLA 2020-02-07 05:32:34 EST
Created attachment 281734 [details]
Minimal working example

I have tried with a fresh workspace and a new project which only contains the attached file. Same problems ( I can find references to the class, the method and the function but not to the variables or the constant).
Comment 2 Dawid Pakula CLA 2020-02-07 15:31:50 EST
Hi, thanks for report.

I checked indexer code, and looks like variable usage isn't indexed, and never was probably due past performance problems.

Currently PDT index only class fields reference (MyClass::$myField / MyClass::MY_CONST).

For now You can only search for variable declaration (ctrl+h -> php search -> field + declarations) but I'm afraid that with lot's of false-positives.

I'm marking as enhancement, entire indexing/search subsystem have to be revisited with new model, see also #558900 and #534691.
Comment 3 Mathieu Dubois CLA 2020-02-07 17:09:50 EST
Thanks for digging into the problem.

Are you sure that constants and variables were never indexed ? I'm almost sure that it used to work: I remember using this functionality to find references of constants across a moderate-size project and it worked like a charm (it was even the main reason for me to switch to Eclipse); I also more or less remember being able to find references to variables without too much false positives (at least in a file).
Comment 4 Mathieu Dubois CLA 2020-09-01 06:03:11 EDT
Just to mention that I update to Fedora 32 (using Eclipse 2020-03 from their repo) and the bug is still here.