Some of the most helpful answers I’ve found are in the music itself. By transcribing what it is that piques my interest musically, I have learned to make the theory come alive in a way that it might not have otherwise. I think the theory you learn in college or wherever is a useful framework for cataloguing your musical ideas and extrapolating new ones but in itself does not inspire. So return to the source, the artists who made you pick up the instrument in the first place and listen. Transcribe what you love and see if you can stretch it rhythmically, harmonically, melodically into a vocabulary of your own. Keep only what you love. Make mistakes, learn from them. Let them go. Be forgiving of yourself and others and keep playing.
Practice connecting your instrument with your voice by vocalizing while you play, unless you play a wind instrument. Be disciplined. If you want to be dogmatic go ahead, though it may limit your circle of friends. I’m from Seattle where the rule seems to be “to each his own” and I’m just fine with that. You can see a prism of the world’s cultures here and I love it. When I hear something that touches me I isolate it and study it and and work it up and down it's given harmonic context. I break things down by key center, and mode. In other words, “What key are we in? What chord are we playing in that key, the IV, the V, etc? What degree is this melodic note relative to the root of that chord?” Some things are atonal and those are usually kind of intuitive on the geometry of the fingerboard, even if they don't fall into a key. I had just played "Freedom Jazz Dance" when this question was posed to me. What had I played and where did it come from? I was following my ears and occasionally my fingers. There were other things like superimposed harmonies and a Michael Brecker lick that I lifted but that intervallic stuff lays on the guitar pretty well. That is such an idiosyncratic melody that just moving motifs from it around can make up a great solo. The diminished scale has a lot to yield toward outside playing but there are other symmetrical scales, like Messian's modes of limited transposition that can be applied to a static harmony to give a sense of movement. Was I thinking of any of this while I played? No. But's it's good to have onboard.