itowlson / fsharp-vs-commands

Commands for working with F# in Visual Studio
5 stars 2 forks source link

The caret is moved to the end of file after the format command executed #1

Open vasily-kirichenko opened 11 years ago

vasily-kirichenko commented 11 years ago

It'd be nice if the caret keeps its original position in which it was before the formatting.

dungpa commented 11 years ago

I think there is no way to find out the updated position of the caret in the formatted text.

We can only keep the caret at the absolute position or scale its position linearly according to the length of formatted text.

vasily-kirichenko commented 11 years ago

I think it'd be fine if we keep the caret inside the code block / expression the caret was in before formatting, because in case of full file / big code block formatting, the code may be reordered significantly and keeping absolute position of the caret is meaningless.

dungpa commented 11 years ago

@vasily-kirichenko Finding out new caret positions is tricky. At the moment, I scale caret positions based on line numbers. I keep your suggestion in mind and implement it when it is feasible.