forcedotcom / salesforcedx-vscode

Salesforce Extensions for VS Code
https://developer.salesforce.com/tools/vscode
BSD 3-Clause "New" or "Revised" License
953 stars 406 forks source link

Apex extension stopped working in big repos #5529

Closed mnunezdm closed 5 months ago

mnunezdm commented 6 months ago

Summary

Since a couple of weeks / maybe days, most of the functionality of the apex extension stopped working in our main repo.

We have a big organization with a lot of apex classes (7000 apex classes), I think this has something to do, because in a smaller org that we have, it works as always

I'm unable to:

Deployment / retrieval, seems to be working, soql is also working

Steps To Reproduce:

  1. Run any of those commands

Expected result

The commans to work

Actual result

The commands not working, it appears the activating extensions bottom bar action for a couple of seconds and the disappear

Additional information

working repo

WORKING

not working repo

Grabación de pantalla 2024-04-05 a las 17 23 36

execute anonymous

Salesforce Extension Version in VS Code: v60.7.0

SFDX CLI Version: @salesforce/cli/2.35.6 darwin-arm64 node-v20.11.1

OS and version: mac os sonoma 14.4.1

VS Code version: 1.88.0

mingxuanzhangsfdx commented 6 months ago

Hi @mnunezdm , could you pop up command palette (cmd+ shift + p), choose Developer: Show Running Extensions and see if all salesforce extensions have been loaded (from you info, it looks like Apex, Apex Replay Debugger are failing)?

Then could you pop up command palette (cmd+ shift + p), choose Developer: Toggle Developer Tools and see if there are any errors?

Also, could you check the output of Apex Language Server (pop up with cmd + shift + u) and any other extensions and see if there are errors?

mnunezdm commented 6 months ago

Hello!

Apex is in activating state

image

I cannot find the apex replay debugger, but I think that extension is launched after the Apex one

The only warning I could find related to this is in the developer toots is this one

 WARN [mainThreadStorage] large extension state detected (extensionId: salesforce.salesforcedx-vscode-core, global: true): 1348.978515625kb. Consider to use 'storageUri' or 'globalStorageUri' to store this data on disk instead.

This is the output of the extension

11:30:11.838 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Scanning built-in and system Apex types.
11:30:11.885 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Scanning built-in Apex types.
11:30:11.889 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Collecting built-in standard types from jar
11:30:13.455 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Done collecting built-in standard types from jar
11:30:13.456 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Scanning Apex Standard Library.
11:30:14.472 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Done scanning Apex Standard Library.
11:30:14.479 [Apex Prelude Service STARTING] INFO  a.j.l.i.s.ApexPreludeManagedService - Starting ApexIndexer.
11:30:14.480 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Start indexer.
11:30:14.512 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning user-defined types.
11:30:14.512 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Scanning workspace source.
11:30:20.667 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Building change list.
11:30:22.412 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Applying found changes
11:30:22.416 [ApexIndexer STARTING] INFO  a.jorje.lsp.impl.index.ApexIndexer - ApexIndexer: Creating 7249 Apex artifacts in Apex DB
abr 06, 2024 11:30:31 A. M. apex.jorje.parser.impl.BaseApexLexer dedupe
INFORMACIÓN: Deduped array ApexLexer.DFA22_transition. Found 7075545 shorts which is 13MB not including array overhead. Removed 6418975 shorts which is 12MB not counting array overhead. Took 54 ms.
mnunezdm commented 6 months ago

First I tried to rename the apex.db in the .sfdx folder with no success

After that I tried renaming the .sfdx folder in my workpsace and automatically the get apex debug logs started working

daphne-sfdc commented 5 months ago

What is your Java version? We currently support Java 11 and 17. If you have a supported Java version, try the below:

Since this is looks like a project-specific issue, can you do the following to get your project into a very clean state?

  1. In the Explorer view of the sidebar, delete the .sfdx and .sf folders.
  2. Run Developer: Reload Window from the command palette.
  3. Re-authorize to your org.

Then check again to see if your Apex extension is able to activate.

github-actions[bot] commented 5 months ago

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

mnunezdm commented 5 months ago

Hello!

I have found what was causing the plugin to stop working after a while

This has something to do with the SOBject refresh, I had this setting active in my project salesforcedx-vscode-core.enable-sobject-refresh-on-startup and some minutes after deleting the .sfdx/.sf folder and reloading window the plugin stopped working again

Disabling that check makes the plugin to stop failing

peternhale commented 5 months ago

@mnunezdm I was wondering in you could enumerate the exact steps you are taking to get the vscode session into a bad state.

github-actions[bot] commented 5 months ago

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