Bug 458335 - PHP Completion block UI
Summary: PHP Completion block UI
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: All Mac OS X
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on: 251156 515454 515580 528256 530416 534395
Blocks:
  Show dependency tree
 
Reported: 2015-01-24 11:48 EST by Dawid Pakula CLA
Modified: 2020-05-14 11:25 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Pakula CLA 2015-01-24 11:48:35 EST
In theory completion run on separate thread, unfortunately is not possible to send signal to stop (for example by IProgressMonitor). So if user will run (manually or auto) any heavy CA (for example throw new | on large project), everything will froze until PDT finish his process.
Comment 1 Dawid Pakula CLA 2017-04-19 09:08:08 EDT
Looks like Eclipse finally have ability to register async CA. Somebody played with new API?
Comment 2 Michal Niewrzal CLA 2017-04-19 09:10:12 EDT
Not yet, I have this on my todo list.
Comment 3 Michal Niewrzal CLA 2017-04-21 13:05:56 EDT
I did small research and to move to async CA we need:
* change in SSE (bug 515454) but it will be the easiest step (of course if someone will merge patch)
* most probably we need to stop using CompletionThread from Openable (DLTK)
* we also need to cleanup CA computation to avoid 'invalid thread access' exceptions (DLTK + PDT)
Comment 4 Dawid Pakula CLA 2017-04-22 07:44:34 EDT
Thanks for that!

Whats wrong with DLTK Openable? Can we fix it?
Comment 5 Michal Niewrzal CLA 2017-04-22 10:23:07 EDT
> Whats wrong with DLTK Openable? Can we fix it?

I'm still not sure why CompletionThread is messing here. In async CA this additional thread is useless so one way or another it would be good to avoid using it. Fixing this shouldn't be a big problem, we need to check if it will be easier to fix it in DLTK or reorganize code in PDT.
Comment 6 Eclipse Genie CLA 2018-03-19 10:57:16 EDT
New Gerrit change created: https://git.eclipse.org/r/119672
Comment 7 Dawid Pakula CLA 2018-04-23 08:57:37 EDT
Patch for WTP has been finally merged. 

When WTP Team publish new photon integration build I'll update PDT side. Problematic CompletionThread is still here, but might be fixed later.
Comment 9 Michal Niewrzal CLA 2018-05-23 13:19:58 EDT
Great work Dawid :)

I found just two small issues.
One
Use this snippet
<?php
echo strlen($string);

Select strlen and press ctrl + space. the exception:
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4552)
	at org.eclipse.swt.SWT.error(SWT.java:4467)
	at org.eclipse.swt.SWT.error(SWT.java:4438)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:503)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:441)
	at org.eclipse.swt.custom.StyledText.getSelectionRange(StyledText.java:4740)
	at org.eclipse.jface.text.TextViewer.getSelectedRange(TextViewer.java:2256)
	at org.eclipse.php.internal.ui.editor.templates.PHPTemplateCompletionProcessor.areMultipleLinesSelected(PHPTemplateCompletionProcessor.java:476)
	at org.eclipse.php.internal.ui.editor.templates.PHPTemplateCompletionProcessor.computeCompletionProposals(PHPTemplateCompletionProcessor.java:173)
	at org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalComputer.computeTemplateCompletionProposals(ScriptCompletionProposalComputer.java:131)
	at org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalComputer.computeCompletionProposals(ScriptCompletionProposalComputer.java:237)
	at org.eclipse.dltk.ui.text.completion.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:342)
	at org.eclipse.dltk.ui.text.completion.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:295)
	at org.eclipse.dltk.ui.text.completion.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:268)
	at org.eclipse.dltk.ui.text.completion.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:234)
	at org.eclipse.wst.sse.ui.internal.contentassist.CompoundContentAssistProcessor.computeCompletionProposals(CompoundContentAssistProcessor.java:127)
	at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup.lambda$8(AsyncCompletionProposalPopup.java:341)

Second
I added something like this in larger code:

throw new |

I pressed ctrl + space in place of | and right away I pressed left arrow. the exception:
java.lang.NullPointerException
	at org.eclipse.dltk.ui.text.completion.ContentAssistProcessor.getCategories(ContentAssistProcessor.java:432)
	at org.eclipse.dltk.ui.text.completion.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:266)
	at org.eclipse.dltk.ui.text.completion.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:234)
	at org.eclipse.wst.sse.ui.internal.contentassist.CompoundContentAssistProcessor.computeCompletionProposals(CompoundContentAssistProcessor.java:127)
	at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup.lambda$8(AsyncCompletionProposalPopup.java:341)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
	at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

I will try find better way to reproduce second problem.
Comment 10 Eclipse Genie CLA 2018-05-23 15:46:19 EDT
New Gerrit change created: https://git.eclipse.org/r/123211
Comment 11 Eclipse Genie CLA 2018-05-23 15:48:32 EDT
New Gerrit change created: https://git.eclipse.org/r/123212
Comment 13 Dawid Pakula CLA 2018-05-23 16:07:54 EDT
I completely forgot about DLTK status syncExec. I used it in DLTK due bug #534402. Since this bug is fixed, we can safely use async call. Patch already uploaded, I merge and publish after couple minutes.
Comment 14 Eclipse Genie CLA 2018-05-28 16:46:58 EDT
New Gerrit change created: https://git.eclipse.org/r/123487
Comment 16 Pierre Rineau CLA 2018-05-31 09:28:36 EDT
I'm working with Eclipse Version: Photon Release Candidate 1 (4.8.0RC1) - Build id: 20180524-1423

It seems that this specific fix broke the content assist feature on my end. It was commited on May 30, I updated following the nightlies this morning, on the May 31, content assist does not work anymore.

I tried unchecking the "Async" checkbox, no change. Tried to clean up my projects, no changes either.
Comment 17 Pierre Rineau CLA 2018-05-31 10:05:39 EDT
Please ignore my previous comment, it seems that my workspace was broken, after manually removing indexes, code assist works fine - for your information, I had to manually delete DLTK index after upgrade, and wait for a very long time for Eclipse to boot after.
Comment 18 Dawid Pakula CLA 2018-05-31 10:10:12 EDT
(In reply to Pierre Rineau from comment #17)
> Please ignore my previous comment, it seems that my workspace was broken,
> after manually removing indexes, code assist works fine - for your
> information, I had to manually delete DLTK index after upgrade, and wait for
> a very long time for Eclipse to boot after.

Recent PDT build require Photon RC2. If you install it into RC1 assist will not work correctly until you turn off async or prefix autocompletion.