salesforcedx-vscode
salesforcedx-vscode copied to clipboard
Apex Language Server Autocomplete not working
Summary
No autocomplete of any sObjects or Fields.
Steps To Reproduce:
- Create new Trigger or Class.
- Attempt to write start of Object or Object.Field and nothing autopopulates
Expected result
I should have Objects and Fields in the dropdown menu below.
Actual result
Dropdown menu pops up without Objects or Fields
Additional information
Related Screen Shots showing Extensions, Java Version, Missing Apex Language Server option from Output Dropdown, missing Objects and Fields from autofill dropdown, successful SFDX: Refresh sObject Definitions. https://imgur.com/a/4i3UQwn
Salesforce Extension Version in VS Code: v54.11.0
SFDX CLI Version: sfdx-cli/7.149.1 linux-x64 node-v16.15.0
OS and version: Fedora 35
@Russell-B can you see if you have any stale processes of the Apex Language Server running? On my mac, I'd run ps -eo pid,args | grep "[A]pexLanguageServerLauncher"
and then kill that open process using the pid. If nothing is running, can you check the Output tab, then navigate to the Apex Language Server option in the dropdown to see if there's an error message in that panel?
[rbangert@fedora usr]$ ps -eo pid,args | grep "[A]pexLanguageServerLauncher" [rbangert@fedora usr]$ ps -aux | grep "[A]pexLanguageServerLauncher"
Both return nothing.
Double checked in the System Monitor GUI tool, and was unable to find anything running with "Apex" in the title.
I am also missing "Apex Language Server" in the Output Drop-down menu you mentioned.
I found this in the Developer Tools Console:
console.ts:137 [Extension Host] Apex language server failed to initialize E @ console.ts:137 log.ts:307 WARN UNRESPONSIVE extension host: 'salesforce.salesforcedx-vscode-apex' took 98% of 5318.719ms, saved PROFILE here: 'file:///tmp/exthost-8dc65e.cpuprofile' Array(4)
I've tried two version of Java, both :
/usr/java/jdk-17.0.3.1/bin/java
/usr/lib/jvm/java-11-openjdk-11.0.15.0.10-1.fc35.x86_64/bin/java
And switched the version with: sudo alternatives --config java
If I set the value to the path of the folder containing the executable file (/usr/java/jdk-17.0.3.1/bin/), I get this error: An unsupported Java version was detected. Download and install Java 8, Java 11, or Java 17 to run the extensions. For more information, see Set Your Java Version.
However, if I set it to the executable it's self (/usr/java/jdk-17.0.3.1/bin/java): That error goes away, and:
[Extension Host] Apex Debugger Extension Activated workbench.desktop.main.js:sourcemap:71 [Extension Host] Apex Replay Debugger Extension Activated
Both load in the developer tools console, but the Apex Language server still throws the same error.
Output of developer tools console:
This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.
Hello, sorry is this is improper. I also ran into this issue (on ubuntu wsl). What fixed it for me was having the Salesforce Java: Home
setting point to the root directory (for me, usr/lib/jvm/java-11-openjdk-amd64
) rather than the full path to the binary (.../bin/java
).