salesforcedx-vscode
salesforcedx-vscode copied to clipboard
Autocomplete not working for implicitly imported Schema namespace
Summary
The Schema namespace is implicitly imported by Salesforce but is not available for autocompletion.
Steps To Reproduce:
- Create a new Apex class and method.
- Declare a variable like "SObjectField myField = null;"
- As you start typing "SObjectF", autocomplete should be available but is not.
Expected result
Autocomplete should work as expected for classes in the Schema namespace without having to fully-qualify them.
Actual result
Autocomplete is not available.
Additional information
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_schema_namespace_using.htm
VS Code Version: 1.46.0 SFDX CLI Version: sfdx-cli/7.60.0-e2bb2907cb win32-x64 node-v10.15.3 OS and version: Windows 10 Enterprise 1809
Hi @Feldhacker - Thanks for the feedback. You do currently have to qualify the namespaces as you experienced. We'll consider this enhancement in the future as we tackle namespace-related items.
Hey @smaddox-sf , I was wondering if there's any plans of getting this enhancement in?
Currently, we do not use vsCode but were looking to move to use the extension. However, if every time in our code we need to qualify the namespace of the current package before an object or class name in our code for autocomplete to be available.... adoption of this in my team is going to be a little less than enthusiastic. Just thought I'd check for an update....
In terms of this happening for Schema object, it makes sense to an extent and that is relatively fine.. However this is happening for our apex classes as well.
Ex. in class 1, want to reference a static method in class 2; To do this, I must call it like namespace.class2.method()
auto complete will only detect the classes with the 'namespace.' in front.