Community
Participate
Working Groups
Have the next code in editor: <?php require_once dirname(__FILE__).| //<-- Invoke code assist here (Ctrl+Space) Expected: CA should be launched. Actual: No completions available. pdt-all-in-one-win32-2.1.0M5
Can you explain the Expected result,it is better to show some example.Thanks
Hi,Kalin Can you tell me the expected result or does this bug still exist? Because i got the CA,but i am not sure if the result is right.
Created attachment 162498 [details] screenshot
Hi Zhaozhongwei, Sorry for my late answer! The suggested items should be: 1. The php files/folders from the current project. 2. The php files/folders from projects which are in include path of the current project. I attached a screenshot for better clarification. Kalin
Thanks very much!
It seems now there are code assist after require_once dirname(FILE).| for example there is a folder named "abc",then choose this proposal,the result will be: require_once dirname(FILE).abc/ but i think here should insert "abc/" or 'abc/' instead of abc/.
hi, I'm looking into this too. I see that content assist works always when user types some special character and then waits a moment. It brings all file/dir proposals from current dir. User can type: require_once . require_once ) require_once WhatEverBlaBlaHelloZhaoKalinJacek) and it always brings content assist. However when I press Ctrl+Space, the content-assist always has no proposals.
ok, the problem is that when pressing Ctrl+Space, context assist is explicitly requested by user. This automatically enables GlobalStatementContext (with variables and functions proposals). Based on the cursor location, also IncludeStatementContext is added - this one serves file names. It's added both on Ctrl+Space and with automatic content assist. So when pressing Ctrl+Space, two contexts are available. They're both exclusive so noone is used.
Created attachment 162687 [details] patch v1 Obvious solution is to make context non-exclusive. With the patch applied, automatic content-assist contains ONLY files suggestions and when activated with Ctrl+Space it brings both file names and functions/variables/etc. This also requires Global content assist strategies to support NULL in some cases to avoid NPEs. The downside is that Ctrl+Space brings HUUGE list of vars and functions and the file names are somewhere at the bottom - practically impossible to find.
(In reply to comment #6) > It seems now there are code assist after... oh sorry, I missed this comment earlier and assumed it's open. Zhao, did you already make any changes to this bug? To which branch?
Looking further at this issue, I see that Ctrl+Space always works inside quotes, so problem happens only when using Ctrl+Space without quotes: WORKS: (brings CA with file proposals) require_once '|' // <-- invoke code assist here (Ctrl+Space) require_once '|' // <-- wait for automatic code assist require_once | // <-- wait for automatic code assist require_once .| // <-- wait for automatic code assist DOESN'T WORK: (brings CA with NO proposals) require_once | // <-- invoke code assist here (Ctrl+Space) require_once .| // <-- invoke code assist here (Ctrl+Space)
(In reply to comment #11) > Looking further at this issue, I see that Ctrl+Space always works inside quotes, > so problem happens only when using Ctrl+Space without quotes: > > WORKS: (brings CA with file proposals) > require_once '|' // <-- invoke code assist here (Ctrl+Space) > require_once '|' // <-- wait for automatic code assist > require_once | // <-- wait for automatic code assist > require_once .| // <-- wait for automatic code assist > > DOESN'T WORK: (brings CA with NO proposals) > require_once | // <-- invoke code assist here (Ctrl+Space) > require_once .| // <-- invoke code assist here (Ctrl+Space) No,i did not upload any changes!Because I could not commit code now,and I have not create any patch for this bug! Sorry for reply you so late,I will see you patch tomorrow:)
Hi Jacek, Can we add the "." character as a trigger to content assist? this way we get this instantly from the engine? Also can you explain what are the nullity checks are needed for? Thanks!
Hi,I just run you patch,it is really a HUUGE list:)
(In reply to comment #13) > Can we add the "." character as a trigger to content assist? is already works that way. > Also can you explain what are the nullity checks are needed for? I've NPE's in those places when testing, however now I see all works fine without null checks. (In reply to comment #14) > Hi,I just run you patch,it is really a HUUGE list:) yea, but that's in fact normal CA contents you get anywhere else.. I'd only bump-up files priority to be at the top of the list AND put them in quotes when CA is invoked outside quotes. I'll improve this patch a bit to remove (or clarify why needed) null checks and bump-up files hints to the top of the list + add quotes arounr them.
Created attachment 162987 [details] patch v2 Improved patch: - ICompletionReporter: Added reportResource(...) method with new prefix argument. To be able to provide proposals with quotes. - PHPCompletionEngine: Hook old reportResource(...) method (without prefix arg) to use new reportResource(...) method with empty prefix by default - GlobalStatementContext and IncludeStatementContext - same as previously. Just disable Exclusive mode - IncludePathStrategy: detect if we're inside quote or not and produce proposals with(out) quotes accordingly Null checks removed -I didn't hit them anymore.