salesforcedx-vscode icon indicating copy to clipboard operation
salesforcedx-vscode copied to clipboard

Apex Language Server Autocomplete not working

Open Russell-B opened this issue 2 years ago • 5 comments

Summary

No autocomplete of any sObjects or Fields.

Steps To Reproduce:

  1. Create new Trigger or Class.
  2. 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 avatar May 09 '22 18:05 Russell-B

@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?

randi274 avatar May 09 '22 19:05 randi274

[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.

Russell-B avatar May 09 '22 22:05 Russell-B

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)

Russell-B avatar May 09 '22 22:05 Russell-B

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.

Russell-B avatar May 09 '22 23:05 Russell-B

Output of developer tools console: devconsoleoutput

Russell-B avatar May 09 '22 23:05 Russell-B

This issue has not received a response in 7 days. It will auto-close in 7 days unless a response is posted.

github-actions[bot] avatar Oct 20 '22 02:10 github-actions[bot]

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).

henry-512 avatar Nov 02 '22 20:11 henry-512