Bug 459947 - Autoassist with global function names inside class body
Summary: Autoassist with global function names inside class body
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact: Sylvia Tancheva CLA
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2015-02-14 12:39 EST by Dawid Pakula CLA
Modified: 2020-05-14 11:24 EDT (History)
1 user (show)

See Also:


Attachments
screenshot1 (16.66 KB, image/png)
2015-04-29 02:32 EDT, Sylvia Tancheva CLA
no flags Details
screenshot2 (4.79 KB, image/png)
2015-04-29 02:33 EDT, Sylvia Tancheva CLA
no flags Details
screenshot3 (16.96 KB, image/png)
2015-04-29 02:33 EDT, Sylvia Tancheva CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Pakula CLA 2015-02-14 12:39:25 EST
Sometimes while creating new function inside class body, global elements become visible

Example:
class Foo {
   | //write fast public function m or public m and wait for autoassit
}

to simplify simulation:
paste "public function" + space + m (fast)

Result:
Suggestions like mysqli_connect become visible.

Expected: 
Nothing

Same for variables.
Comment 1 Michal Niewrzal CLA 2015-02-15 16:35:33 EST
It looks that GlobalStatementContext is using IModelElement.getElementAt() and after fast typing (pasting) changes are not reconciled yet. GetElementAt() is using old source ranges from model (but offset for element is actual) and returned element is null. I went deeper and I found that DirtyRegionProcessor from WST has delay (500 ms) between reconciliations (this delay is also sometimes visible with highlighting). I'm not sure why this value is so big.
Comment 2 Dawid Pakula CLA 2015-02-17 11:34:24 EST
Same delay is also in JFace AbstractReconciler (JavaReconciler using it)

We can add simple backward code scan to verify and avoid confusion.
Comment 3 Michal Niewrzal CLA 2015-02-17 11:54:43 EST
Yes, probably it is best solution. We just need to remember that other contexts can be also affected with this problem.
Comment 4 Michal Niewrzal CLA 2015-03-23 12:44:11 EDT
Different case to cover:
<?php
trait NEWTRAIT {
}
class NEWCLASS {
	// |
}

In place "|" press Enter and type fast e.g. "pro". CA will propose global methods e.g. "proc_close()".
Comment 5 Eclipse Genie CLA 2015-03-23 12:52:15 EDT
New Gerrit change created: https://git.eclipse.org/r/44394
Comment 7 Michal Niewrzal CLA 2015-03-26 14:56:30 EDT
Fixed.
Comment 8 Sylvia Tancheva CLA 2015-04-29 02:30:12 EDT
Can you please check again. I see now the following 2 problems:
* With Dawid's examples I get now proposals for templates which are also irrelevant for the current context.
* With Michal's example now if I type 'pro' fast enough I do not get any proposals automatically (I need to press ctrl+space to autocomplete to protected). If I fast-type only 'pr' I get templates.
I will attach few screen-shots
Comment 9 Sylvia Tancheva CLA 2015-04-29 02:32:45 EDT
Created attachment 252875 [details]
screenshot1
Comment 10 Sylvia Tancheva CLA 2015-04-29 02:33:02 EDT
Created attachment 252876 [details]
screenshot2
Comment 11 Sylvia Tancheva CLA 2015-04-29 02:33:21 EDT
Created attachment 252877 [details]
screenshot3
Comment 12 Eclipse Genie CLA 2015-10-22 18:08:15 EDT
New Gerrit change created: https://git.eclipse.org/r/58767
Comment 14 Dawid Pakula CLA 2015-10-26 11:30:55 EDT
Done. Other problems with invalid context/proposals after fast typing should be resolved as separate issues.
Comment 15 Sylvia Tancheva CLA 2015-11-02 09:10:31 EST
So I see that most things are solved except from the templates?
Comment 16 Sylvia Tancheva CLA 2015-11-03 07:27:13 EST
I created a different issue for the templates - see Bug 459947.
Closing this one.