I installed visual studio code from a tar file in /opt/ . So I had to make a desktop file for the application as shown below
[Desktop Entry] Type=Application Name=Visual Studio Code MimeType=text/plain Actions=New; Icon=vso.png Exec="code" Categories=Utility;TextEditor;Development;IDE; Terminal=false #StartupWMClass=code
exec code works perfectly since i have made a symlink. I don't understand where the problem in this file is especially because there is no way to test it and get any errors as far as i could find.
EDIT The file didn't work even when i set an absolute path for exec