0

I use VSCode for Salesforce development and the outline section just keeps loading but never loads. It works well for JS files but doesn't show at all for apex files. And due to the same reason, I am unable to see the listing of methods. I have to use file search to look for methods which provide me with unwanted results.

Edit 1- I tried deleting .apexlink_cache folder in C:\Users<User directory> folder but it provides no help.

Edit 2- ALS output 22:50:11.423 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types. 22:50:11.494 [ApexIndexer STARTING] INFO a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning user-defined types. 22:50:11.495 [Apex Prelude Service STARTING] INFO a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types took 72 ms. Apr 29, 2022 10:50:13 PM 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 21 ms.

enter image description here

1 Answer 1

0

This happens when the Apex Language Server (ALS) is either not running or not running properly. I'm not sure why you thought deleting .apexlink_cache would fix the problem, as it doesn't appear to be related to the ALS at all (I can't even find such a folder on my system, and my ALS is working just fine).

Installation

Make sure the Salesforce Extension Bundle is installed and on the latest version. Also, make sure that VS Code is running on the latest version.

Fresh Start

The ALS, and other extensions, take some time to load when you first start. Try waiting 30 seconds before using any ALS features.

Corrupted Cache

The cache can become corrupt, which will affect both Auto-Complete and Outline View. Try deleting PROJECT_DIR/.sfdx/tools/apex.db, restarting VS Code, and trying again.

Invalid Project Directory

Make sure you're actually in an SFDX Project directory. While this is not strictly required, it can help to make sure that ALS decides it doesn't need to run because you're not using Apex. If you can't see the Open Org, View Code Coverage, and Select Default Org buttons on your toolbar, that may indicate a problem.

Java Not Installed

Make sure you have a JRE (Java Runtime Environment) 8 or JRE 11 installed.

Java Not Configured

Make sure you have JRE configured in Settings > Salesforce Apex Configuration > Salesforcedx-vscode-apex: Java: Home.

Other Causes

Check the OUTPUT panel in VS Code under the Apex Language Server to check for any error messages that may be present. In addition, check the Status bar to see if you have any errors there. You may be able to fix this without going to the...

Nuclear Option

If all fails, you can try uninstalling everything related to this (Java, SFDX CLI, VS Code), deleting the entire .sfdx found in both your user home directory as well as within any project directories, and finally reinstalling everything in order: JRE 8/JRE 11, SFDX CLI, VS Code, Salesforce Extension Bundle. I recommend doing this only if you can't otherwise figure out the issue, as it does take a while to install and configure everything.

5
  • apexlink cache folder is showing in my laptop due to apexflow plugin however as you said, it has nothing to do with ALS. But despite following all but last instruction as mentioned in your answer, I am not getting the outline loaded. And doing the last step is not possible for me at the moment.
    – love gupta
    Commented Apr 27, 2022 at 17:10
  • @lovegupta Hmm, have you checked the ALS Output window? Can you share that with me? I'll be happy to try and provide more specific guidance.
    – sfdcfox
    Commented Apr 27, 2022 at 17:13
  • edited the question with ALS o/p
    – love gupta
    Commented Apr 29, 2022 at 17:24
  • and then i run a script to cleanup the code and download all dependencies and regenerate models.. and then it shows the outline again. Everytime I switch my git branch, i have to do it
    – love gupta
    Commented Apr 29, 2022 at 18:55
  • @lovegupta That sounds like you need to update your gitignore and/or scripts used to clean up. This shouldn't be happening if everything is set up correctly.
    – sfdcfox
    Commented Apr 29, 2022 at 18:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .