There are two components involved here. One is indeed ear training, and the other one is knowing your instrument well, i.e. being able to produce any melody as effortlessly as you do with your voice. And for this second part, you do not need to consciously know the intervals as long as you intuitively find the right notes on your instrument.
But anyway, start with intervals. First try to be able to recognize them by ear. Make sure you can play any interval with every possible fingering on the guitar. Then train yourself to produce intervals with your voice. This makes sure that you've really mastered them. Play some random note on the guitar and let it ring. Decide which interval you want to produce, and then sing the chosen interval (up or down) from the note you're playing. Then you check if you're correct by playing the second note of the interval on the guitar. This makes sure that you got it right, but it also makes sure that you're able find the intervals on the guitar.
Another good practice is to play simple melodies that you know well without preparation (and without sliding until you hit the right note). Try to force yourself to avoid patterns that you know well. So e.g., just play the melody on one string or on two strings, play it in different octaves, start the first note with your index finger, with your pinky, etc. Then move on to more complex melodies. Play as slowly as necessary, but stick to the correct rhythm.
Since you're one of the lucky ones who actually have the melodies in your head (you said you can do vocal improvisation), just start a backing track, come up with a melody and sing it, and then figure out the melody on your guitar. If you made a mistake, find out which interval you got wrong, and what the reason was: either you didn't hear it correctly or you knew what it was but you couldn't produce it on the guitar. Based on this information, go back to practicing that interval.
You can do this all day long, even if there's no guitar around. Say you hear a melody (either outside or inside your head), then you just imagine how you would play it on the guitar. If you have doubts, analyze the melody in terms of intervals and see if you were right or not.
One last exercise that in my experience helps a lot for the ear training part is playing the low E string and let it ring (wait, that's not it yet). Then, without looking, you play a random note on one of the higher strings (while the low E still rings out). Now you name the note (and/or its function), still without looking. The octave doesn't matter. So if you happen to hit the 10th fret on the high E string (without knowing, because you didn't look), you should say or think "flat 7". Then you look and confirm you're correct.