Salesforcedx-vscode: Autocomplete / IntelliSense not working

Created on 3 May 2020  路  10Comments  路  Source: forcedotcom/salesforcedx-vscode

Summary

Autocomplete / IntelliSense not working for Apex code. On both SObjects and built in Apex functions.

Steps To Reproduce:

  1. Open Salesforce project, with existing classes.
  2. Run sfdx sobject definitions refresh -u ORG_NAME
  3. Type something and wait for the autocomplete

Expected result

Should show autocomplete/IntelliSense or snippet suggestion

Actual result

No autocomplete suggestions.

Additional information

SObject definitions pull in nicely.

Screenshot_2

Autocomplete doesnt work so nicely.

Screenshot_1

Additional information
VS Code Version: 1.44.2
SFDX CLI Version: 7.56.1-2773b53bf5
OS and version: Windows 10 Home, Version 1909
JAVA Version: jdk-11.0.7

Have tried using various environments, both sandboxes and scratch orgs. Projects have very few apex classes, or any other components.

Test Classes do work very nicely, and I have double checked my JAVA_HOME/JDK_HOME paths (in addition to adding "salesforcedx-vscode-apex.java.home": "C:\\Program Files\\Java\\jdk-11.0.7", to preferences.

Apex Language Server output log

19:59:22.493 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types.
May 03, 2020 7:59:23 PM apex.jorje.parser.impl.BaseApexLexer dedupe
INFO: Deduped array ApexLexer.DFA22_transition. Found 7075527 shorts which is 13MB not including array overhead. Removed 6418975 shorts which is 12MB not counting array overhead. Took 12 ms.
19:59:26.822 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Patching standard library for System.Database.* methods
19:59:26.832 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Done patching standard library for System.Database.* methods
19:59:28.150 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning user-defined types.
19:59:28.154 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types took 5659 ms.
19:59:38.908 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning user-defined types took 10740 ms.

Other related issues
https://github.com/forcedotcom/salesforcedx-vscode/issues/2095
https://github.com/forcedotcom/salesforcedx-vscode/issues/920
https://github.com/forcedotcom/salesforcedx-vscode/issues/935

apex bug

All 10 comments

Is there a work-around for this issue? Barring that, is there a specific version set (VSCode, SFDX) that I can install to get fully-functional autocomplete for Apex classes? For what it's worth, I'm seeing the same logging output for the Apex Language Server.

autocomplete is not working on trigger files
it works on certain variables but not work on other ones

image

image
(it shows no suggestions)

(no errors on apex language server)
vscode: 1.51.1
java: 11.0.9

@gab95 I have the same issue on autocomplete not working for variables defined inside trigger files. No issue on class files.

Thanks for the additional info @kkevinreyes

@kkevinreyes @gab95 We are looking for an open source repository where we can reproduce this issue for testing. Do either of you happen to have an example project where completions from within the trigger files are not working?

Please also include:

  • VS Code Extension version
  • OS and version
  • Enable the setting "salesforcedx-vscode-apex.advanced.enable-completion-statistics": "true". This will output additional information into the Apex Language Server output channel. It will help us determine if this is a performance issue.

Thank you again for your help!

This issue has been automatically closed because there has been no response to our request for more information from the original author. Currently, there is not enough information provided for us to take action. Please reply and reopen this issue if you need additional assistance.

Still no luck with autocomplete in either class files or triggers.

image

enabled "salesforcedx-vscode-apex.advanced.enable-completion-statistics": "true" and got an extra 2 lines of logging (last 2 lines here).

09:52:47.454 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types.
Apr. 10, 2021 9:52:48 AM apex.jorje.parser.impl.BaseApexLexer dedupe
INFO: Deduped array ApexLexer.DFA22_transition. Found 7075528 shorts which is 13MB not including array overhead. Removed 6418975 shorts which is 12MB not counting array overhead. Took 10 ms.
09:52:50.104 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Patching standard library for System.Database.* methods
09:52:50.109 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Done patching standard library for System.Database.* methods
09:52:50.743 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning user-defined types.
09:52:50.744 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types took 3290 ms.
09:53:03.619 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: StandardObjects: 731
09:53:03.619 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: CustomObjects: 6
09:53:03.619 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: ApexFiles: 157
09:53:03.619 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: ErrorFiles: 65
09:53:03.619 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning user-defined types took 12860 ms.
Apr. 10, 2021 9:57:50 AM org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint notify
INFO: Unsupported notification method: $/setTraceNotification

VS Code Version: 1.55.1
Salesforce Extension Pack (VS Code): 51.8.0
SFDX CLI Version: 7.90.2
OS: Windows 10 Home, Version 10.0.19043
Java version: jdk-11.0.7

This issue has been linked to a new work item: W-9145638

@lukethacoder Have you tried opening a sample-app project like dreamhouse-lwc? I'd like to see if even just a basic demo works. If still no luck there, might try a more nuclear option of uninstalling the extension pack, closing vs code, reopen vs code, and reinstall the extension pack. Try to open dreamhouse-lwc again and see if that works.

If we can get it to work with dreamhouse, that at least tells us there's something about the project structure or Apex contents of the projects you're working with that the language server isn't handling properly. If we can't, that seems like a sign that maybe something with the machine's setup is causing a communication problem.

Do other language server features work? If you right click a method or Apex class reference and select "find all references" or "rename symbols", does it do so successfully? This also will help isolate the problem.

I reckon it might be something machine related. Have nuked vs code + the sf extension pack multiple times over the past few months, again today, and even setup on a new machine with similar issues.

Installed and setup the dreamhouse-lwc project to see if that would work, but it still isn't playing nice.

image

Right clicking on an apex method doesn't even give the option for "find all references" or "rename symbols".

image

Apex Language Server logs look the same as posted up further.

Was thinking maybe my Java install might have been the issue (still might be) but I still have intelliJ and Illuminated Cloud 2 working just fine. This issue is one of the only reason I havn't fully moved over to VS Code.

VS Code Version: 1.55.2
Salesforce Extension Pack (VS Code): 51.11.0
SFDX CLI Version: 7.99.0
OS: Windows 10 Home, Version 10.0.19043
Java version: jdk-11.0.7

Was this page helpful?
0 / 5 - 0 ratings