The VSCode extension from salesforce uses Salesforce CLI under the hood to manage the authorization .
CLI provides ability for you to authorize as many as orgs you would like with an option to set default org at the project level and also you can set default globally if you would like .
Below are some key points to understand
Your project directory has hidden directory .sfdx with a file sfdx-config.json.This file holds the default username .
You can also find a similar folder in your Operating system HOME directory that holds few more files . It will have file for every org you logged in json format with access token and refresh tokens to manage auth .
Now when you say you authorized it without alias thats not good practice .I would recommend when you authorize your org set a unique alias for each org and also select one of them as default alias .
Your vscode editor will show you default alias in the footer ,(you can even click and log into the org from there )
Salesforce is building capability to allow you to switch between orgs easily that will make life simpler .You can switch today easily by running sfdx force:config:set defaultusername=<alias>
in terminal .
Always make sure to set a defaultusername for your project so that way you know which org your local project saves and retrieves files .
The activation event for Salesforce's official extension is it looks for the file sfdx-project.json
file in the workspace. Hence make sure you have the sfdx-project.json
in the project workspace root folder.
Also, make sure you have .sfdx
folder and also have an sfdx-config.json file with defaultusername
set.
Also, try to reload the project using the reload command in command Palette. If the issue still persists feel free to post what your project structure looks like.
NOTE: The official extension has got better since I wrote the answer. It now has all the features that were missing and was supplemented by my extension.
Also yes I created another extension because the official extension has few issues that they are trying to figure still
1.Performance issues for saving single files. You can easily compare that what I have today is at least 2X faster than what you get from the official extension.
This is because they use Metadata API even for single file deploy which as per salesforce has performance issues and they plan to fix it in an upcoming release.
2.The package.xml generation is easier using changesets or unmanaged package container and the official extension does not offer a good GUI to generate them.
3.Official extension uses apex lang server for auto-completion that almost consumes a lot of my CPU. I would rather not have autocompleted than an extension trying to consume my whole CPU.
4.Official salesforce extension does not manage conflict with the server for Nonscratch orgs like sandboxes. It's in their roadmap.
5.Salesforce recommends using the new source format which I too recommend however if you are finding issues with that format the extension I have supports both DX typed source format and traditional source format.
Overall the idea of me building an extension was not to replace Salesforce's official extension instead supplement it with some missing capabilities till salesforce figures all of them.
Best Answer
If anybody experiences this issue, the workaround would be to turn off Experimental Deploy Retrieve on settings under User and workspace.