The distinction you have to make is the one between ranged attacks and ranged weapons. Although daggers, handaxes, javelins, light hammers, spears, and tridents can be thrown to make ranged attacks, they are still melee weapons-- so they don't get the benefit of the fighting style.