How to run Apex anonymous code from Visual Studio Code
In the command palette, if you type "sfdx ex" you will be offered this if you have some Apex text selected:
SFDX: Execute Anonymous Apex with Currently Selected Text
or this:
SFDX: Execute Anonymous Apex with Editor Contents
if you don't.
Not too sure why there is also this .apex file thing too. As the project is open source you can see open issues, all issues, pull requests etc here https://github.com/forcedotcom/salesforcedx-vscode/issues.
For all those command liners, you can also use force:apex:execute
sfdx force:apex:execute -u MyConnectedOrg
Start typing straight into the terminal or copy/paste your code of interest. Ctrl+D will execute the code