Maybe you should see if taking a few weeks off from work is possible.
I won't advise you about depression since I don't qualify to do so,but I do know changing your environment can have a significant psychological impact. It could make things better or worse.
When a program doesn't work right you need someone who understands how programs work, to debug them,analyze the root cause and implement a fix. Doesn't have to be a therapist,just find someone who qualifies and let them debug you.
Edit: Interesting post on hn you might find useful: https://news.ycombinator.com/item?id=17523475