lionel- / codegrip

Reshaping and navigation commands for R code
Other
209 stars 7 forks source link

Reshape info cursor position #23

Open dgkf opened 2 months ago

dgkf commented 2 months ago

The upcoming release of LSP will support SnippetEdits as returned WorkspaceEdits in a code action, which allows for setting the cursor position after reshaping so that it stays on the same syntax element after applying the reshape.

To allow this, I updated reshape_info so that it returns the character index where the cursor should be in the replacement text. This is determined by finding the same non-whitespace character index in the new text.