I have another problem but with the code editor this time it does not let me create a new tab even when I right click and click new tab nothing happens I tried uninstalling it and installing it again but the problem is still there I can't write anything literally
I think this is the solution for your problem
To fix this issue:
Make sure you don't have any unsaved files in Scratch when run as root (with the sudo command). This fix will delete those files.
Open Terminal and use root permissions to remove the directory.
sudo rm -rf ~/.local/share/scratch-text-editor
Open Scratch as your own user (do not use the sudo command)
Scratch is the old name of Code
With Code the command should be:
sudo rm -rf ~/.local/share/io.elementary.code
I had the same issue several times both on Juno and Hera. And usually it worked fine after a fresh install. But I just came to see that sometimes even after a fresh install, it doesn't open. So here is the solution:
(here the "user" is your username on eOS).
chmod 777 unsaved/