When I compile an esp32 ino, the IDE loads an old version of the file and destroys all the changes, which I have done.
When I noticed this, I activated the auto save and the IDE worked as it should. Then I rebooted my Linux and IDE and now there is this same nuisance. The auto-save is activated.
This behaviour seems to be somewhat arbitrary, because I have managed to build my project so far 1100 lines.
Where do each of the files reside? Try save as to see which directory it wants to save your file in, do not save, I just use that to find the path.
I am guessing but I think you have two different folders. Be very careful of spelling and case as Linux is case dependent.
You can also do this from the Linux terminal window:
find -iname "tecmint*"
Where "tecmint* is the file name with anything else following, the '*' is a wild card.