I strongly encourage everyone to try keeping a gratitude journal - just write three positive things that happened to you today.it can really change the way you look at your life.
A lot of the suicidal ideation has to do with lack of agency and control over your situation in life. I am a firm believer that you need to take a step back and look at the possibilities in your life. You are not just a SWE/whatever your job is - you are a problem solver, someone with curiosity, someone dedicated someone who is playing other roles in life than just an employee - a friend, a parent, neighbour, child etc
If you feel like you have no control over the path you are in - change the path, don't stop the walk. You can move to a different career, different country, different partner. Sure some of our circumstances cannot be changed - but don't make the arbitrary standard of life you set for yourself determine whether your life is worth living.