I have some "intellectual" suicidal ideation primarily in response to the anxiety attacks on top of the chronic pain.  In some ways, pain is tolerable because I can reason with it.  Anxiety, however, doesn't response to reason, and that can lead to an existential crisis.  As an engineer and scientist, I know exactly how I would end my life reliably and painlessly with helium inhalation, but I haven't acquired the materials.  As long as I recognize intellectually that my pain and anxiety are the result of chemical processes in my brain which I hope can be repaired, I continue my existence.  With no hope, there is no justification for a life of misery.