Short answer: You said it: "while typing". LaTeX code can be typed with any text editor and even any word processors, so this is a problem of the editor, not the LaTeX code, that it must be unambiguous. Use a editor with this feature, as
Long answer: Since
xetex, etc work with an already typed code, a LaTeX solution would require a posteriori the interpretation of your thoughts in that you have typed, a needless complication in IMHO. For instance, what to do with this simple code?:
2", 5" and 7"
May be you want here
2``, 5'' and 7", or may be
2", 5`` and 7'' or simply
2", 5" and 7" exactly as you typed? What to do if this interpretation is wrong? It will be a pain if you need to re-edit to be more specific about what you want really.
Instead, if the interpretation of your thoughts is done by the editor, misinterpretation is less painfull. Following the example, if you typed in TeXWorks
2", 5" and 7" and "more" will be typed
2'' and 5'' and 7'' and ``more'' (note that each
" are now two characters) that probably is what you want, but in other case you can change easily in a second.
Anyway, this feature is not painless, since this force that
" (single character) must be obtained with
Ctrl+Shift+2 instead of the usual