I think this change would help. There may be one more missing rule though:
Take this line:
this ##
If I position my cursor after the first # it, currently triggers auto-complete.
And this:
some stuff #abcdefg
If I use the left arrow key to go back through #abcdefg, it is triggered at every position. It feels like it should only be triggered when I’m positioned at the end of that string.
So maybe the logic should be something like:
Trigger auto complete iff:
#is preceded by whitespace AND- cursor is followed by whitespace AND
- characters between
#and cursor are all valid hashtag characters OR - (no characters between
#and cursor AND#not at beginning of line)