How to enable or configure "Salesforce Extensions for VS Code" plugin on Visual studio code IDE to compile my Apex,Visualforce on the scratch org when I save the file locally.

I have just started using it and I have to manually run the command sfdx force:source:push either from command prompt or from the command pallette in IDE.

Is there an easy option like we had in Mavensmate and Force IDE?


I opened issue with salesforcedx-vscode project:

  • 1
    Most recent update from the GutHub issue: This isn't on our roadmap at this time. We are looking into what we can do to improve the Aura and Visualforce language servers, but we don't have any timeline right now. – Robs Sep 12 '18 at 16:35
  • @Robs I have seen on one of the blogs that they are suggesting nodemon util to get this working as a workaround. Because there is a workaround maybe they are not treating as high priority. – javanoob Sep 12 '18 at 16:37

You can't compile your code automatically like you did before with the first version of the Eclipse plugin. The new plugin makes use of the Language Server Protocole which will help you find errors locally, but you'll still have to use sfdx force:source:push to compile everything.

If you have access to the Trailblazer Community, there is a thread about this here.

Additionally, you can automatically push your changes to your Scratch Org using Nodemon, as described in this blog post.

|improve this answer|||||
  • Thanks. Both the links are pointing to the same github url. Also, it is not showing any error message in VScode if I write any gibberish. Here is the screenshot: imgur.com/a/BnTIJ – javanoob Oct 30 '17 at 14:29
  • 1
    Sorry, updated the link ^^Not sure what is currently supported by the language server, it's a good question. You could either ask on the Chatter post or directly on the SalesforceDX vscode plugin github: github.com/forcedotcom/salesforcedx-vscode/issues – Fabien Taillon Oct 30 '17 at 14:37
  • Thanks. Luckily, I was part of pilot program so have access to the community. Posted a comment for Wade and Josh. I hope they will look into it and provide update. Thanks again. – javanoob Oct 30 '17 at 14:45
  • 1
    Just added an additional way to do it as described in Nathan Totten's blog post :) – Fabien Taillon Feb 5 '18 at 17:09
  • Is there any possibility we connect scratch org with MavensMate in VS code? – Banshi Lal Dangi Aug 22 '18 at 5:06

If you're looking for auto deploy, you can set this in the workspace settings... To push files each time you save them, set the user or workspace setting


Reference to Article


|improve this answer|||||
  • I upvoted because it does deploy when a file is saved, but only when done via an open folder (project), when "Saving" the same file from within a "Workspace" it does not deploy. – NZ Dev Jul 30 '19 at 1:07

This feature has been added in a Feature Preview option to the Salesforce VS-Code extension. Click here for details.

|improve this answer|||||

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.