question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code completion, find references and go to definition not working on large org

See original GitHub issue

Summary

When using VS Code with Salesforce plugin on a large org, the code completion, find references and go to definition is not working. The test panel is also empty.

Steps To Reproduce:

  1. Create a project and get source code from a large org.
  2. Right click on a method and select Find all references or Go to Definition.

Expected result

The reference panel should show corresponding references or the editor should open the definition.

Actual result

The panel remains empty and the Apex Language Server console is displaying the following error :

GRAVE: Internal error: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:99)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
	... 11 more
Caused by: java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Unknown Source)
	at sun.misc.IOUtils.readFully(Unknown Source)
	at java.util.jar.JarFile.getBytes(Unknown Source)
	at java.util.jar.JarFile.getManifestFromReference(Unknown Source)
	at java.util.jar.JarFile.getManifest(Unknown Source)
	at sun.misc.URLClassPath$JarLoader$2.getManifest(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$100(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at org.eclipse.jdt.internal.core.nd.field.FieldSearchIndex.asList(FieldSearchIndex.java:300)
	at apex.jorje.lsp.impl.index.ApexIndex.getTestMethods(ApexIndex.java:247)
	at apex.jorje.lsp.impl.tests.StandardTestService.getTestMethods(StandardTestService.java:58)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint$$Lambda$129/13276447.apply(Unknown Source)
	at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
	at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:192)
	at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
	at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:99)
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)

Additional information

The issue seems related to #1103 and #1101. I get this issue since 3 days only with large org (500 classes, 50 triggers, 180 pages, 380 tests) but not with SFDX small projects.

VS Code Version: 1.33.1

SFDX CLI Version: 45.12.1

OS and version: Windows 10 Enterprise Version 10.0.15063

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
praksbcommented, Aug 6, 2019

@TwistyPop I am a Salesforce employee and work on the Apex extension. We are aware of the perf issue and has been incrementally rolling out fixes that would improve the experience for customers with huge number of Apex classes and triggers. #1430 is one such fix that would reduce the memory usage. We have work in our backlog to continue to make such improvements in the near future.

0reactions
ClemABTcommented, Nov 4, 2019

@TwistyPop the setting I changed is salesforcedx-vscode-apex.java.home I set it up to point to a 64-bits JRE located in C:\Program Files\Java\jre1.8.0_231

Read more comments on GitHub >

github_iconTop Results From Across the Web

Go to Definition and Find References not working
Yesterday, I installed an Ubuntu partition on my HDD, and vscode worked perfectly, with peek definition, find references etc.
Read more >
Fix: VS Code Go to Definition Not Working - YouTube
Visual Studio Code (VS Code ) is a very popular code editor among the developers of the world. This is due to it's...
Read more >
Working with JavaScript in Visual Studio Code
Visual Studio Code's JavaScript IntelliSense provides intelligent code completion, parameter info, references search, and many other advanced language ...
Read more >
PHP Tools for Visual Studio and VS Code by DEVSENSE
Array shapes improve your code completion, as it provides code completion for ... Also there were issues when problems and IntelliSense did not...
Read more >
Configuring Visual Studio Code | Editors and IDEs - Drupal
vscode-intelephense-client): provides support for PHP code completion and intellisense that supports any PHP file extension (module, inc, etc...) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found