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 194294

Summary: Code Completion broken in 7.0
Product: php Reporter: larsomat
Component: EditorAssignee: Petr Pisl <ppisl>
Status: VERIFIED FIXED    
Severity: normal CC: mmirilovic, pjiricka, tzezula, vriha
Priority: P1    
Version: 7.0   
Hardware: Macintosh (x86)   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 196925, 196930    
Bug Blocks:    

Description larsomat 2011-01-13 08:13:00 UTC
Assume I have a Doctrine-Class called "MyObjectTable".

When I type "$q = MyObjectTable::getInstance()->..." autocomplete doesn't work in Netbeans 7.xx.
It did work in Netbeans 6.9 without problems.
Comment 1 larsomat 2011-01-13 08:19:46 UTC
When I'm inside the class and type "self::getInstance()->..." autocomplete works, though...
Comment 2 maghiel 2011-03-14 13:13:30 UTC
I need to reverify, but voting P1 for now. imho Symfony support should just work before public RC
Comment 3 Petr Pisl 2011-03-16 14:40:26 UTC
When there is code in one file:
<?php

class Cls1 {
	
	
	static public function getInstance() {
		return new Cls1();
	}
	
	public function getName(){
		
	}
}


class Cls2 {

	public function doSomething() {
		Cls1::getInstance()->
	}

}
?>

then cc after Cls1::getInstance()-> works, but when you create new file with 

<?php
class Usage {

	function neco($param) {
		Cls1::getInstance()->
	}

}

?>

then cc after Cls1::getInstance()-> doesn't work. But when is defined return type through php doc 

        /**
	 *
	 * @return Cls1 
	 */
	static public function getInstance() {
		return new Cls1();
	}

the the cc works in both cases.
Comment 4 Petr Pisl 2011-03-16 18:05:03 UTC
I know the problem now. It's regression from some performance fixes that was done in December. It influence every method in any class, it's really P1. The problem is that in the index now are not stored return types of methods, for functions it still works.

The body of methods are scanned lazy, only when we need it during editing the files. When you need find out return type, then you have to scan the body of the method, if there is no php doc with @return tag.

In the index, due to the change, the data about a method doesn't contains the return types. So when the code completion takes information from index, there are no return types of method, when the information is taken from model that it's build for the edited file, then everything works because the model provide appropriate return type lazy.

I don't know now how to fix it properly, with keeping good performance during editing big files.:(
Comment 5 Petr Pisl 2011-03-21 13:09:06 UTC
I have change the subject to reflect better the situation and also component.
Comment 6 Petr Pisl 2011-03-21 13:16:35 UTC
So one of the solution could be to scan whole file during indexing source roots. When the user will edit a file, the file will be scanned lazy as it now. It means that the first scanning of a project will take more time.

For this we need to recognized, whether we are scanning whole root and we can use method isAllFilesIndexing() in org.netbeans.modules.parsing.spi.indexing.Context, at least according the javadoc. Unfortunately the behavior of the method doesn't reflect it's documentation and should be corrected the behavior or the documentation. 

The second part of the problem is recognizing, whether the index infrastructure is calling our php indexer, when the file is modified.
Comment 7 Petr Pisl 2011-03-22 17:33:56 UTC
Fixed in the web-main.

Could I ask QA to test it? Thanks.
Comment 8 Marian Mirilovic 2011-03-24 08:33:52 UTC
Vlada, if you will have time ... please look at this as well. Thanks in advance.
Comment 9 larsomat 2011-03-24 08:57:42 UTC
Had a short look in Build 201103220400. Seems to work so far with my current symfony project. Will test extensively next week.
Comment 10 Marian Mirilovic 2011-03-24 09:00:19 UTC
(In reply to comment #9)
> Had a short look in Build 201103220400. Seems to work so far with my current
> symfony project. Will test extensively next week.

larsomat, thanks a lot. 


Petr, I think you can integrate the fix into release70. Please do so today by 8pm. Thanks in advance.
Comment 11 Quality Engineering 2011-03-24 09:49:03 UTC
Integrated into 'main-golden', will be available in build *201103240400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/c0b15d6791dc
User: Petr Pisl <ppisl@netbeans.org>
Log: #194294 - Code Completion broken in 7.0
Comment 12 Petr Pisl 2011-03-24 13:32:33 UTC
The fix was also transplanted into release70.
Comment 13 Vladimir Riha 2011-03-24 19:29:20 UTC
Sorry for delay, I'll test it during weekend
Comment 14 Vladimir Riha 2011-03-28 07:27:03 UTC
verified