Autocomplete for fields of SObjects doesn't work

Issue #120 resolved
Matej Pinter created an issue

With update to 1.6 autocomplete for fields of SObjects and custom objects stopped working.

Comments (49)

  1. Scott Wells repo owner

    Hi, Matej. I didn't (intentionally?) make any changes in 1.6 that should have affected completion aside from the one around @TestVisible-annotated members. I just tried to reproduce this locally and am getting completions for fields of both standard and custom SObjects. Hopefully whatever is happening in your environment is something that can be resolved quickly. Do you mind going rebuilding your caches & indices and/or sending me anything relevant from idea.log?

  2. Matej Pinter reporter

    Ah I see, rebuilding cache worked. I tried regenerating OST several times, thought this is causing this, but now it works. :) Thanks.

  3. Scott Wells repo owner

    Glad to hear. Sorry you had to do that. I thought I'd worked out exactly which indices needed to be rebuilt automatically and had bumped their versions. Guess not...

  4. Fred Chen

    I have the same issue and rebuilding cache/indices doesn't solve the problem. all custom and standard sobjects are in OST. the version I am using is 1.6.8.0, IDEA version 15.0.2

  5. Scott Wells repo owner

    Hi, Fred. Did you rebuild just Illuminated Cloud caches/indices or all of IntelliJ's caches/indices? If the former, do you mind also doing the latter? Either way, if it's still not resolved, let me know and we'll verify some configuration items to see why it may not be finding those for completion.

  6. Fred Chen

    I tried to rebuild Intellij’s caches/indices but didn’t help. I got following error in idea.log when rebuilding caches.

    2016-01-13 13:40:12,850 [ 173753] ERROR - View.AbstractTreeStructureBase - null java.lang.NullPointerException at com.illuminatedcloud.intellij.structureview.ApexProjectTreeStructureProvider.modify(SourceFile:78) at com.intellij.ide.util.treeView.AbstractTreeStructureBase.getChildElements(AbstractTreeStructureBase.java:53) at com.intellij.ide.util.treeView.AbstractTreeUi$32.perform(AbstractTreeUi.java:1624) at com.intellij.ide.util.treeView.TreeRunnable.run(TreeRunnable.java:33) at com.intellij.ide.util.treeView.AbstractTreeUi.execute(AbstractTreeUi.java:1830) at com.intellij.ide.util.treeView.AbstractTreeUi.getChildrenFor(AbstractTreeUi.java:1621) at com.intellij.ide.util.treeView.AbstractTreeUi.loadElementsFromStructure(AbstractTreeUi.java:2207) at com.intellij.ide.util.treeView.AbstractTreeUi.updateNodeChildrenNow(AbstractTreeUi.java:1367) at com.intellij.ide.util.treeView.AbstractTreeUi.access$3300(AbstractTreeUi.java:62) at com.intellij.ide.util.treeView.AbstractTreeUi$27.perform(AbstractTreeUi.java:1282) at com.intellij.ide.util.treeView.TreeRunnable.run(TreeRunnable.java:33) at com.intellij.openapi.util.ExecutionCallback.doWhenExecuted(ExecutionCallback.java:100) at com.intellij.openapi.util.ActionCallback.doWhenDone(ActionCallback.java:111) at com.intellij.ide.util.treeView.AbstractTreeUi.doUpdateChildren(AbstractTreeUi.java:1278) at com.intellij.ide.util.treeView.AbstractTreeUi.access$3100(AbstractTreeUi.java:62) at com.intellij.ide.util.treeView.AbstractTreeUi$26$1.perform(AbstractTreeUi.java:1182) at com.intellij.ide.util.treeView.TreeRunnable.run(TreeRunnable.java:33) at com.intellij.ide.util.treeView.AbstractTreeUi.execute(AbstractTreeUi.java:1830) at com.intellij.ide.util.treeView.AbstractTreeUi.access$2500(AbstractTreeUi.java:62) at com.intellij.ide.util.treeView.AbstractTreeUi$26.perform(AbstractTreeUi.java:1179) at com.intellij.ide.util.treeView.TreeRunnable.run(TreeRunnable.java:33) at com.intellij.openapi.util.ActionCallback$ExecutedExecutionCallback.doWhenExecuted(ActionCallback.java:187) at com.intellij.openapi.util.ActionCallback.doWhenDone(ActionCallback.java:111) at com.intellij.ide.util.treeView.AbstractTreeUi.updateNodeChildren(AbstractTreeUi.java:1174) at com.intellij.ide.util.treeView.AbstractTreeUi.updateSubtreeNow(AbstractTreeUi.java:1080) at com.intellij.ide.util.treeView.AbstractTreeUpdater$3.perform(AbstractTreeUpdater.java:258) at com.intellij.ide.util.treeView.TreeRunnable.run(TreeRunnable.java:33) at com.intellij.openapi.util.ActionCallback$ExecutedExecutionCallback.doWhenExecuted(ActionCallback.java:187) at com.intellij.openapi.util.ActionCallback.doWhenDone(ActionCallback.java:111) at com.intellij.ide.util.treeView.AbstractTreeUpdater.performUpdate(AbstractTreeUpdater.java:254) at com.intellij.ide.util.treeView.AbstractTreeUpdater$2.run(AbstractTreeUpdater.java:215) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327) at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271) at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:2316) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:283) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244) at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234) at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238) at com.intellij.util.Alarm$Request$1.run(Alarm.java:352) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.a(LaterInvocator.java:337) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:321) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at com.intellij.ide.IdeEventQueue.f(IdeEventQueue.java:866) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:381) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 2016-01-13 13:40:12,895 [ 173798] ERROR - View.AbstractTreeStructureBase - IntelliJ IDEA 15.0.2 Build #IU-143.1184.17 2016-01-13 13:40:12,905 [ 173808] ERROR - View.AbstractTreeStructureBase - JDK: 1.8.0_40-release 2016-01-13 13:40:12,906 [ 173809] ERROR - View.AbstractTreeStructureBase - VM: OpenJDK 64-Bit Server VM 2016-01-13 13:40:12,909 [ 173812] ERROR - View.AbstractTreeStructureBase - Vendor: JetBrains s.r.o 2016-01-13 13:40:12,916 [ 173819] ERROR - View.AbstractTreeStructureBase - OS: Mac OS X 2016-01-13 13:40:12,922 [ 173825] ERROR - View.AbstractTreeStructureBase - Last Action:

  7. Scott Wells repo owner

    Interesting. That's obviously a bug, but it shouldn't be affecting completion of SObjects. The effect of that would be a node in the project tree showing up without all of the adornments (wrong icon, etc.).

    Okay, let's run through a quick checklist of things that must be in place for SObject completion to work properly:

    1. The OST must be generated.
    2. The OST must contain stub Apex classes for the SObjects.
    3. There must be an SDK created for the OST (this should happen automatically as part of OST generation).
    4. The Illuminated Cloud module containing the source that will reference SObjects must be configured for the SDK (again, this should happen automatically).
    5. Caches and indices must be up-to-date for the SDK (should happen automatically, but you've done this explicitly now as well).

    In 1.6.8.0 I've added validation logic on project open to ensure that these things are in place. If not, you'll get a tooltip balloon in the project after it opens that will help you remedy any issues. I'm assuming you don't have any based on what you've already described, but we can be sure by looking at the Project Structure window. In that window there's a Problems section that will identify any configuration issues and guide you through fixing them. Can you check that?

  8. Fred Chen

    I checked Project Structure windows and there is no problem. I just realized that Standard Sobject is working on autocompletion and I can also navigate to the class. But custom sobject still doesn’t work. I didn’t include custom SObject in the metadata. So they are not retrieved but I do see all my custom objects in OST. Do I have to include custom sobject in the metadata in order to support autocompletion?

    Fred

  9. Scott Wells repo owner

    No, the metadata selection for the project doesn't affect the generated OST, at least not for SObjects. It should generate a stub Apex class for every SObject in the org as part of the OST, and all of those should be available in completion. Let's try something else...I have quite a bit of debug logging in the completion logic that may help us understand why those aren't available. Please add the following under Help>Configure Debug Log Settings:

    #com.illuminatedcloud.intellij.completion.ApexCompletionProvider
    #com.illuminatedcloud.intellij.completion.ApexCompletionRule
    #com.illuminatedcloud.intellij.completion.ApexCompletionContext
    

    Then just use completion in a place where you'd expect custom SObject names to be shown. In idea.log you should see quite a bit of detailed logging coming from those classes showing what things were evaluated for completion along with which were accepted/rejected and why. If you don't mind sending that to me, hopefully I can get some better insights. Thanks!

  10. Scott Wells repo owner

    Fred, I'm not seeing logged info in your most recent comment. Feel free to attach it here or email it to me at "scott at illuminatedcloud dot com".

  11. Scott Wells repo owner

    Guess not. Got it that time, though. Let me take a look. I'll let you know what I find.

  12. Scott Wells repo owner

    Okay, unfortunately that's not showing me anything hugely useful. It does show that visible identifiers are being offered as completions (quite a few!), but not which are and aren't visible.

    Let's verify 100% that one of these custom SObjects that you're expecting is in fact in the OST. Can you navigate to it by name? If so, does the stub Apex class generally look correct? Also, if you explicitly type out a valid reference to it, does the reference highlight when the cursor is on it, and can you go to the declaration? If you're not sure how to do any of these things, just let me know and I'll give you more detailed steps to follow.

  13. Fred Chen

    I verified that the custom sobject stub apex class is in OST. But I can neither look up the class nor navigate to it. when I use the shortcut (Cmd + Space) to show autocomplete, it says “No Suggestions”. However all standard sobjects are working flawlessly.

    Fred

  14. Scott Wells repo owner

    Thanks for following up, Fred. That's actually good because it indicates consistent behavior. Do you mind sending me one of the OST classes for an SObject that's not working? Feel free to send it via email if you'd like. Also, are you open to a screen share so perhaps I can help debug this a little more interactively?

  15. Scott Wells repo owner

    Okay. I'm available at 12-1PM CST if that works for you. If not, please let me know what does work and we can try to set something up.

  16. Scott Wells repo owner

    Fred, here's a build with additional diagnostic logging:

    https://drive.google.com/file/d/0B2eoK6ID4_FeblZjXzc4Y0NpaFU/view?usp=sharing

    Once you install that, add debug logging for the following class:

    #com.illuminatedcloud.intellij.navigation.AbstractApexChooseByNameContributor
    

    Then try to go to one of your custom SObject classes by name. You should see quite a bit of logging about what it's evaluating while trying to find the matching class file. If you don't mind, send that my way and I'll see what it indicates.

  17. Scott Wells repo owner

    This is very helpful, Fred. Thanks! One thing I see that could very well be the root cause is a stack overflow trying to walk the inheritance hierarchy. I'm going to look at why that might be happening and see if I can address it. I also noticed that Event__c is not included in the names of custom objects. Can you see if perhaps this works properly for, say, Location__c or Slot__c?

  18. Fred Chen

    Location__c does work but that’s in a named package. all custom sobjects that are in default/unamed package are unable to lookup.

    Fred

  19. Fred Chen

    this time when I open IDEA, it gives me this: Invalid configuration for module 'test' Module 'test': The following must be configured properly: module must have at least one configured connection module must have a generated offline symbol table module must use an Illuminated Cloud™ SDK

    Full resolution of these items may require multiple steps. After I configure the connection, It starts to rebuild OST but still no luck with custom sobjects

  20. Scott Wells repo owner

    Yeah, I didn't expect this build to resolve the issue as much as to give me some additional diagnostics. Let me spend some time with this new log and see if it allows me to make progress. Thanks again!

  21. Scott Wells repo owner

    Fred, just wanted to let you know that I'm continuing to look at how I can get to the bottom of this. I'll be out of pocket for a bit today while I travel for business but will let you know next steps soon.

  22. Scott Wells repo owner

    Fred, sorry for going dark for a week. My business trip monopolized my time last week, and because it was in the Carolinas, the return trip has been...interesting (stuck along with ~60 other canceled flights in Charlotte last night and currently operating on ~3 hours of sleep so that I could catch the next flight home). I'll add some additional diagnostic logging to see what's getting added to the index that's used for these completions so we can continue to corner and ultimately resolve the issue. I appreciate your patience!

  23. Scott Wells repo owner

    Fred, I will be posting a new build today with the additional logging I proposed above. I'll update this issue when that log is available with any additional instructions about how to produce the log info. Hopefully that'll show me what I need to see and get you back to having custom SObject completions properly. Sorry for the long delay getting this to you!

  24. Scott Wells repo owner

    Fred, I've just uploaded version 1.6.8.2 with considerably more debug logging around the problem that you're seeing. In addition to the entries you've already added based on our prior discussion, please add the following to Help>Configure debug log settings:

    #com.illuminatedcloud.intellij.index.AbstractApexDeclarationNameIndex
    #com.illuminatedcloud.intellij.index.ApexDeclarationShortNameIndex
    

    Then open IC's connection settings screen and click the Rebuild button to force indices to be rebuilt. Go ahead and allow the IDE to restart just to things into a clean state. After indices are rebuilt, try to go to one of the SObjects by name again. Once you've done all that, please send me the resulting idea.log file(s). I should be able to see what's getting added to the indices and how they're getting (or in this case, not getting) used.

    By the way, there's a small chance that the problem may be resolved by this build. There was a logical sub-expression that wasn't properly nested for evaluation. I'd be very surprised if it was causing this, but I wanted to let you know that it's possible it might have been the root cause.

  25. Fred Chen

    This time it worked after I installed the new build. I enabled logging settings and attached the log file to you.

  26. Scott Wells repo owner

    Okay, so does it seem like this is resolved for you now, Fred? If so, I'll go ahead and resolve the issue. Also you should probably clear the lines under Help>Configure debug log settings as that amount of active debug logging will slow things down.

  27. Log in to comment