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.

Improve Apex Autocomplete

See original GitHub issue

Summary

When Autocomplete is run on an SObject, it returns Global objects (EG System, ApexPages), which are not valid given the current instance context. It also only returns a very limited set of fields.

Steps To Reproduce:

  1. Create new class call testing
  2. Add the following code:
public class Testing {
    public Testing() {
        Account acc = new Account();
        acc.
    }
}
  1. Trigger a completion request on acc.

Expected result

I would see the SObject Instance methods and all of it’s fields (including custom fields)

Actual result

I see the SObject instance methods, the global System namespaces & and very limited set of fields.

Additional information

testing_cls_ _realself

VS Code Version: 1.26.0

SFDX CLI Version: salesforcedx@pre-release

OS and version: osx 10.12.6

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
ChuckJonascommented, Feb 21, 2019

Adding to the List…

I can’t seem to get static variables and functions to auto-complete either.

IMO the lack of decent auto-complete really is the biggest productivity killer.

Is there a team working on this? I understand the challenging of building AST, but other multiple other individuals have been able to do a pretty decent job of it…

Seems like a company as big as salesforce should be able to figure out how to write autocomplete for their own language pretty easily

PS: I’m not trying to be snarky, I’m just sincerely wondering this issue is a priority.

2reactions
vazexqicommented, Aug 20, 2018

@ChuckJonas -

[Context] " it returns Global objects (EG System, ApexPages)" – yes this is a known issue right now. We show a lot of the global namespaces as a fallback. We should probably disable this.

[SObjects] Did you do a “SFDX: Refresh SObject Defintions” after you have connected to an org? See https://github.com/forcedotcom/salesforcedx-vscode/tree/develop/packages/salesforcedx-vscode-apex#enable-code-smartness-for-sobjects for more information.

We need to do an sobjectdescribe on the org to get the information – yes, this deviates a bit from our SFDX model but the org currently still has the most information about the standard objects, custom fields, and custom objects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IDE: Autocomplete for Apex and Visualforce code
Hoping we get intellisense / auto-completion done for Eclipse IDE at minimum for Apex anywhere soon. Lightning support would be good to, but...
Read more >
Implementing autocomplete suggestion for record ids
The first approach that comes to my mind is to prefetch record IDs of all records in the org and then match on...
Read more >
Performance of text field with autocomplete — oracle-tech
I am using APEX 22.1.1. I'm using a text field with autocomplete. It's based on a varchar2 column that has +14k record. Performance...
Read more >
How to Enable Intellisense Support for Salesforce Apex Code ...
In this blog, we will look into how to enable Intellisense support for Salesforce metadata. Enabling this feature will increase code writing ...
Read more >
A glimpse of the APEX 22.2 new features - Autocomplete - Insum
The Autocomplete item has been reimagined as a native APEX web-component and provides a more streamlined user experience, support for icons, ...
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