it works like this. know 2 scale patterns very well. play them for fun, so that you can picture them on the fretboard as easily (in your mind) as you can see all the white keys on the piano, that's your major scale. then learn where the roots are, then learn where the diatonic triads are and then picture those superimposed on the major scale pattern for each of the 2 main patterns at least to start with. when practicing the major scale patterns, play up and down the 2 octives and then up and down in 3 notes at a time, advancing by one note, then up in 3rds (every other note) and advance one note at a time up and down, then practice the arpeggios of all of the diatonic chords triads at first, then advance to the 4 note chords, for each of the 2 scale patterns. I use the C scale pattern starting at fret 3, then the G Major scale pattern starting at fret 3 as my 2 main ones, at the present time.
then to put it together, start getting used to changes - record a few chord patterns, start with I to IV, then I IV V in a 12 bar blues progression, then go to I vi ii V then add the 4 notes too IMaj7 vi-7 ii-7 V7 over and over in the 2 patterns, then start including other progressions and try to be melodic and use the scales for passing tones, but also the arpeggios and make sure you know what note in the arpeggio you are playing the 1, 3, 5, 7 etc. so now you know the location of each step in the major scale patterns and the components of each of the diatonic chords in the pattern.
i love the melodic first take feeling, isn't it great!? I have one I should post to see what you think of it, actually I have about 50, but the one I just did was a memorable one.
i also know where all the blue notes are and the minor pentatonic superimposed on top of the major scale pattern for more of a pop/rock/folk/blues/country feel