This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 208284 - Autocomplete does not work for new class properties, constants or methods
Summary: Autocomplete does not work for new class properties, constants or methods
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal with 3 votes (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-11 09:17 UTC by igorya
Modified: 2013-06-26 11:54 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
new variable $var1 does not detected by autocomplete (22.39 KB, image/jpeg)
2012-02-11 09:17 UTC, igorya
Details
NB doesn't detect new property "testvar" (118.39 KB, image/jpeg)
2012-03-29 09:23 UTC, igorya
Details
projectB (3.12 KB, application/zip)
2012-03-29 10:17 UTC, Vladimir Riha
Details
projectA (3.16 KB, application/zip)
2012-03-29 10:19 UTC, Vladimir Riha
Details
screenshot (47.24 KB, image/png)
2012-03-29 10:20 UTC, Vladimir Riha
Details
CC problem with global variable (49.02 KB, image/png)
2013-06-03 14:02 UTC, mmolda
Details
CC problem with class variable (81.58 KB, image/png)
2013-06-03 14:02 UTC, mmolda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description igorya 2012-02-11 09:17:53 UTC
Created attachment 115615 [details]
new variable $var1 does not detected by autocomplete

If I create NEW class property or class constant or method then it is not detected by autocomplete engine. For solving this problem I have to reopen project or restart NB, but it is very inconvenient. Also import of default settings (section General->All other unspecified) can solve this problem. But after certain actions in editor the problem appears again. For the proof see the attached file.

This problem was in all early NB 7.x versions. I also tried reinstall NB and java, but it did not help.
Comment 1 Ondrej Brejla 2012-02-13 10:10:06 UTC
I can't reproduce it :( It works for me properly in 7.2 dev build. Can you test it there? If the problem still occurs, reopen this issue and provide more info how to reproduce it... I'm not able to do that :(
Comment 2 igorya 2012-02-15 12:46:17 UTC
(In reply to comment #1)
> I can't reproduce it :( It works for me properly in 7.2 dev build. Can you test it there? 

Sorry, but I can't use dev version in my project. I will wait for beta or release version.

> If the problem still occurs, reopen this issue and provide more info
> how to reproduce it... I'm not able to do that :(

1. Try to put source code and nbproject data to another location then default location (Documents and Settings\<user>\My Documents\NetBeansProjects\)

2. Open 2 projects, with names like "proj.one" and "proj.twho". In second project set "Include Path" to value = "path\to\1st_project\proj.one\includes"

This hypothesis. Other non-default values​​, I did not set
Comment 3 igorya 2012-03-29 09:23:48 UTC
Created attachment 117452 [details]
NB doesn't detect new property "testvar"
Comment 4 igorya 2012-03-29 09:34:42 UTC
(In reply to comment #1)
> I can't reproduce it :( It works for me properly in 7.2 dev build. Can you test
> it there? 

I tested on version "Dev 201203280401" - see atached file ``NB doesn't detect new property "testvar"''. And the problem is exists :(

> If the problem still occurs, reopen this issue and provide more info how to reproduce it... I'm not able to do that :(

I run NB with command line key "--locale en".
Try to open 2 projects, with names like "proj.one" and "proj.twho". In second
project set "Include Path" to value = "path\to\1st_project\proj.one\includes"

This hypothesis. Other non-default values​​, I did not set.

Also, can you make the following:
If the user add/modify/remove any class constant/property/method then NB re-init project structure ? This will solve the problem, because If I reopen project, then NB "sees" a new class property.
Comment 5 Ondrej Brejla 2012-03-29 09:37:22 UTC
Vlado, please, can you reproduce that? Thanks.
Comment 6 Vladimir Riha 2012-03-29 10:16:17 UTC
I guess I managed to reproduce, but not sure what exactly cause it :)

What I did:
- create 2 projects in different folders, close them
- close NetBeans
- start NetBeans, open both project 
- set Include path of projectA to folder of projectB
- create new subfolder in projectB called "includes"
- remove include path in projectA and add new to projectB/includes
- create class in projectB in subfolder that is included by projectA
=> suggested issue occured

The problem is that I can't reproduce it in any other class, just the single one... The problem appears in ProjectB in includes/Test.php

I'll attach both projects.

Project A location:
C:\Users\tester\Documents\b\PhpProject2

Project B location:
C:\Users\tester\a\PhpProject2


Product Version: NetBeans IDE Dev (Build 201203280401)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Windows 7 version 6.1 running on x86; Cp1252; en (nb)
Comment 7 Vladimir Riha 2012-03-29 10:17:37 UTC
Created attachment 117453 [details]
projectB
Comment 8 Vladimir Riha 2012-03-29 10:19:46 UTC
Created attachment 117454 [details]
projectA
Comment 9 Vladimir Riha 2012-03-29 10:20:44 UTC
Created attachment 117455 [details]
screenshot
Comment 10 Ondrej Brejla 2012-03-29 11:12:40 UTC
Really crazy scenario :-) But thanks for evaluation, I'll try to look at it. But I'm not sure with the result, maybe it's not a PHP issue, maybe something wrong with scanning and indexing. We'll see.
Comment 11 igorya 2012-03-29 11:22:29 UTC
(In reply to comment #6)
> I guess I managed to reproduce, but not sure what exactly cause it :)
> 
> What I did:
> - create 2 projects in different folders, close them
> - close NetBeans
> - start NetBeans, open both project 
> - set Include path of projectA to folder of projectB
> - create new subfolder in projectB called "includes"
> - remove include path in projectA and add new to projectB/includes
> - create class in projectB in subfolder that is included by projectA
> => suggested issue occured
> 
> The problem is that I can't reproduce it in any other class, just the single
> one... The problem appears in ProjectB in includes/Test.php

I didn't understand you. Did you reproduced this bug ?
And can you developer team simply add feature about which I wrote:
If the user add/modify/remove any class constant/property/method then NB
re-init project structure (class/method/props/consts relations) ?

PS. I use java build 1.6.0_31-b05 on win XP. But, I think,  this is never mind. And the problem is exist in all early NB 7.x versions.
Comment 12 Vladimir Riha 2012-03-29 11:37:21 UTC
(In reply to comment #11)

> I didn't understand you. Did you reproduced this bug ?

Yes, I did. Btw, if you go to main manu Source | Scan for external changes it fix the problem.

Ondra: FYI, as igorya wrote, reopening NB fixes it and I reproduce it with newly created class again
Comment 13 Ondrej Brejla 2012-03-29 11:43:39 UTC
Vlada: yep, so it really seems that files are not scanned properly.
Comment 14 igorya 2012-03-31 15:18:10 UTC
(In reply to comment #12)
> (In reply to comment #11)
> 
> > I didn't understand you. Did you reproduced this bug ?
> 
> Yes, I did. Btw, if you go to main manu Source | Scan for external changes it
> fix the problem.

Yes, it works. But it does not always help on version 7.1.1 :(
Comment 15 Ondrej Brejla 2012-04-05 08:57:33 UTC
I tried the same scenario as Vlada in comment #6 and it worked for me properly. I created new class in new subfolder, and then I created new object, in the second project, from that "new subfolder class" and tried to use CC for a method and it worked :(

Product Version: NetBeans IDE Dev (Build 20120403-d05888281c3a)
Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02
System: Linux version 3.0.0-17-generic-pae running on i386; UTF-8; cs_CZ (nb)
User directory: /home/warden/userdir
Cache directory: /home/warden/userdir/var/cache
Comment 16 igorya 2012-04-05 09:17:46 UTC
(In reply to comment #15)
> I tried the same scenario as Vlada in comment #6 and it worked for me properly.
> I created new class in new subfolder, and then I created new object, in the
> second project, from that "new subfolder class" and tried to use CC for a
> method and it worked :(


> 
> Product Version: NetBeans IDE Dev (Build 20120403-d05888281c3a)
> Java: 1.6.0_26; Java HotSpot(TM) Client VM 20.1-b02
> System: Linux version 3.0.0-17-generic-pae running on i386; UTF-8; cs_CZ (nb)

This BUG is not depend from any products versions. And it exists in ALL 7.x NB version. Perhaps it also depends on the structure of the project. Please, make SIMPLY thing:

If the user add/modify/remove any class constant/property/method then NB
re-init project structure.

Already there is no strength and patience :(
Comment 17 Ondrej Brejla 2012-04-05 09:19:54 UTC
Finally I'm able to reproduce that, thanks Vlado :)
Comment 18 Tomas Mysik 2012-05-02 04:51:55 UTC
Láďo, could you provide steps to reproduce? I'm a bit confused :) Are the steps from comment #6 the right ones?

Just reassign back to me, thanks.
Comment 19 Vladimir Riha 2012-05-02 09:16:25 UTC
(In reply to comment #18)
> Láďo, could you provide steps to reproduce? I'm a bit confused :) Are the steps
> from comment #6 the right ones?
> 
> Just reassign back to me, thanks.

Yes, they are :) I just reproduced it. You can omit closing the 2 projects and restarting NB. Simply create 2 projects and continue with Set Include path... 



Product Version: NetBeans IDE Dev (Build 201205020400)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Comment 20 Tomas Mysik 2012-10-04 10:24:54 UTC
Sorry, works for me properly (steps from comment #6) in the current dev build. 

Product Version: NetBeans IDE Dev (Build 20121004-9e091c41a7f6)
Java: 1.6.0_35; Java HotSpot(TM) 64-Bit Server VM 20.10-b01
System: Linux version 3.2.0-31-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 21 igorya 2013-06-01 11:48:44 UTC
God day.

Anybody can fix this fucking BUG ?!
From version 7.1 to 7.3 it still exists :((((((((((((((((((((
Comment 22 mmolda 2013-06-03 14:01:19 UTC
I can reproduce it in few steps. Both project can be in same folder, included folder can have arbitrary name.

I also tried litte different code (without class) - see screenshots.

1. open NetBeans
2. create new projectA, create new projectB
3. create some folder in projectB
4. in projectA set include patch to projectB/createdFolder
5. in projectB/createdFolder create new PHP file
6. in that file CC doesn't work

Project A location: C:\xampp\htdocs\projectA
Project B location: C:\xampp\htdocs\projectB

Product Version: NetBeans IDE 7.3.1 (Build 201305301707)
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b13
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
Comment 23 mmolda 2013-06-03 14:02:13 UTC
Created attachment 135274 [details]
CC problem with global variable
Comment 24 mmolda 2013-06-03 14:02:48 UTC
Created attachment 135275 [details]
CC problem with class variable
Comment 25 mmolda 2013-06-03 14:15:09 UTC
It doesn't work with:

<?php
class Foo {
    function __c| <--- invoke CC here = no suggestions
}
?>

Normally CC shows with __call(), __callstatic(), __construct()...
Comment 26 Tomas Mysik 2013-06-04 05:37:15 UTC
Ondro, see comment #25 - these magic methods are provided automatically, right? Do you have any idea why in this case they are not in CC?

Thanks.
Comment 27 Ondrej Brejla 2013-06-04 09:04:55 UTC
Not so exactly. They are resolved by index as well. In CC there is this piece of code:

request.index.getAccessibleMagicMethods(classElement)

where classElement is ClassElement resolved by index...so if index doesn't return any class (which is the case why CC doesn't work in that directory) then "getAccessibleMagicMethods" is never called.
Comment 28 Ondrej Brejla 2013-06-04 09:29:34 UTC
Imho the problem is, that indexer indexes that "testB/testfolder/Foo.php" file under the "testB/testfolder/" root...but CC (and corresponding IndexQueryImpl) searches "testB" root (and virtual FSs). The "testB/testfolder/" root is missing there.

If one tries to complete that "testB/testfolder/Foo.php" class from "testA" project, it works properly, because "testB/testfolder/" root is included in IndexQueryImpl root list.
Comment 29 Tomas Mysik 2013-06-24 15:40:31 UTC
So, the problem is that you are putting "testFolder" and not the whole project on Include Path. In other words, instead of "testFolder", simply add Source Files of ProjectB and it will work. The reason is that nested source roots are not supported so we are going to add a check for it to the Include Path dialog.

Thanks for repoting.
Comment 30 Tomas Mysik 2013-06-25 09:06:32 UTC
Done as written in my last comment. Thanks for reporting.

http://hg.netbeans.org/web-main/rev/c5adc305f134
Comment 31 Quality Engineering 2013-06-26 02:32:33 UTC
Integrated into 'main-golden', will be available in build *201306252301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c5adc305f134
User: Tomas Mysik <tmysik@netbeans.org>
Log: #208284 - Autocomplete does not work for new class properties, constants or methods
Comment 32 mmolda 2013-06-26 11:54:25 UTC
verified. thanks