[VS] Set scrollbar and caret positions after formatting documents

The mechanism is not ideal but ok for now.

We scale these positions linearly based on document lengths. It's better
to filter out whitespace lines in the end to be more precise.