I'll give you my recipe. I have a recipe because I've burnt myself out a couple of times in my career. Not the best thing to do, but I like to work and sometimes in pursuing one's passion one over does it.
1. Forgive yourself. You worked hard. You made a couple of less than optimal moves. It happens to the best of us. You may not realise it, but often people feel "stupid" or "weak" for having gotten into the burn out situation. Give yourself a break. Also realise: it's likely to happen again because enthusiastic people get themselves into this situation. Don't fear it. Accept who you are and work within your own nature.
2. Forgive others. I wrote a fantastical piece on this a long time ago: http://mikekchar.github.io/portfolio//UsefulAndBeneficial (It's surprisingly short for something written by me). TL;DR: People strive to be useful and then complain when they are used. Instead do what you do because it is in your nature to do it and maneuver yourself into a place where this provides benefit for others. It's easy to blame others for the situation you are in because they selfishly accept everything you give them. They may even selfishly ask for things that you give them. However, give them a break. It's fine if people ask for things, even if they are selfish. The key is learning how to break out of the "useful" mould.
3.Find out why you are a programmer. I can't actually give you good advice here because I don't know why you are a programmer. I can tell you that I never wanted to be a programmer. I wanted to be an author. But then my parents (wisely, I suppose ;-) ) suggested that the job of "author" is not very secure. So I picked my second best thing, which was programming. And then for at least the next 20 years I did my best to find a way to quit from that job. However, I kept getting sucked back in. I thought I was cursed. And then I realised it: I love programming. That's why I do it. Even when I don't have to program, I'm programming. My curse is that I love it, which is why I can never break free from it. See: you aren't the most screwed up person in this conversation! But anyway, you are a programmer for a reason. You might not realise what that reason is. Your reason is probably not the same as my reason. However, without knowing what your reason is, it will be hard to continue. If you suspect (which I bet that you do) that you don't actually have a reason to be a programmer, then try something else. Work at MacDonald's. Do whatever. It doesn't matter. You'll figure out pretty quickly why you are a programmer.
4. Write code. Write code every day. Start small. I like doing pomodoros. If you can only do one pomodoro a day, then only do one pomodoro a day. Try to do 2 some days and eventually you will be able to do 2. Keep trying to do more pomodoros. Or whatever measurement of work floats your boat. But write code. Every day.
And that is it. I'll be honest, though. I think you are suffering from more than burn out. Depression can happen as a result of burnout, but thoughts of suicide, etc are pretty worrying. You may have an underlying health condition that needs treatment. I recommend continuing to see the relevant health professionals and getting whatever treatment you can. I know lots of people with mental health problems. It's important to understand that this is a health issue. In the case of thoughts of suicide, it's a potentially fatal health issue and should be treated just the same as a heart condition, for example. Our science sucks for these kinds of health issues, but it's getting better over time. Many of my friends have had really good success and there is no reason to believe that you won't have similar success. It might take some time, though.
I hope that's helpful! It's always hard to give good advice on this kind of issue because it depends so much on the individual. Just try to keep a positive outlook. Belief is more than half the battle.