+ Start a Discussion
Fernando Gonzalez 24Fernando Gonzalez 24 

VS Code does not show class/object definition symbols.

I am developing with VS Code and have it set up with my sandbox. However when I create instances of objects I do not get the helpful list of class properties. 

example:

Account account = new Account();
account.(should show correct properties here)
 
Best Answer chosen by Fernando Gonzalez 24
Fernando Gonzalez 24Fernando Gonzalez 24
The issue was that java 8 was not properly installed and referenced in my workspace.
In my sfdx -> .vscode -> .settings.json 

Key: "salesforcedx-vscode-apex.java.home" was not referencing correct path to java folder.
 

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Fernando,

Greetings to you!

To activate the extension’s code smartness features for standard and custom objects and their fields, including for custom fields on standard objects, press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows or Linux), and then select SFDX: Refresh SObject Definitions from the command palette.

When you refresh your sObject definitions, VS Code uses your default org to generate faux Apex classes. These faux classes represent the standard and custom objects that the admin user has access to for your default scratch org, or the logged-in user of your sandbox or DE org. The classes are stored in a hidden directory on your local workstation. Don’t edit the faux classes! They are deleted and regenerated each time that you refresh your sObject definitions. To modify your sObjects, either modify the objects’ .object-meta.xml and .field-meta.xml files (and then run SFDX: Push Source to Default Scratch Org or SFDX: Deploy Source to Org), or make changes declaratively in your org (and then run SFDX: Pull Source from Default Scratch Org or SFDX: Retrieve Source from Org). Your user doesn’t automatically gain access to new custom objects, so be sure to assign new permissions to the user as necessary. To assign permissions from the command line, run sfdx force:user:permset:assign -n YourPermSetName.

After you add or edit standard or custom objects or their fields, be sure to rerun SFDX: Refresh SObject Definitions.

Reference: https://github.com/forcedotcom/salesforcedx-vscode/tree/develop/packages/salesforcedx-vscode-apex#enable-code-smartness-for-sobjects

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Fernando Gonzalez 24Fernando Gonzalez 24
This has not resolved my issue. I refresh my objects and retrieve my sanbox org and it does not help.
Fernando Gonzalez 24Fernando Gonzalez 24
The issue was that java 8 was not properly installed and referenced in my workspace.
In my sfdx -> .vscode -> .settings.json 

Key: "salesforcedx-vscode-apex.java.home" was not referencing correct path to java folder.
 
This was selected as the best answer