I use the Ctrl+Shift+P to run a Create a new Apex class command. However, I the a pop-up with an error message saying that command sfdx.force.project.create was not found. The problem is that somehow the command which is executed by the script replaced colons with full stops. When I run this command from the terminal in its proper form, then a class is created. Is it possible to fix this issue? It is rather a nuisance, but the quick SFDX menu significantly improves development workflow.

  • In your VSCode settings, what do you have when you search for Salesforcedx-vscode-apex › Java: Home? That setting needs to be set correctly for the Salesforce Extension Pack to work.
    – Derek F
    Aug 19 at 13:28
  • { "salesforcedx-vscode-apex.java.home": "C:\\Program Files\\AdoptOpenJDK\\jdk-" }
    – sfentrydev
    Aug 19 at 13:30

VS Code's commands have a name for every command, such as sfdx.force.project.create. This command name is used to look up what module code should be run when the menu item is activated. In other words, SFDX: Create Project links to sfdx.force.project.create, which calls a script that prompts you for the name to use, and then calls something like sys('sfdx force:project:create -n $param'). The command names are cached so they are more or less immediately available on startup, but the Salesforce DX Extension Bundle takes a few seconds to initialize, so some commands may fail for the first few seconds after startup.

First, check to make sure that your extensions are enabled, particularly the Apex extension, which drives most of the commands. Second, check the OUTPUT tab under Apex and make sure that the "language server" has started. If not, you'll need to wait. If you get any errors from the server, you may need to install an appropriate version of Java.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.