You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, after issue only a "change" action from the LSP, the entire region of replaced text is selected after the code action. Instead, it would be more intuitive if the same cursor remained selected through the transformation, mapping its original position to its final position.
To support this, it would be helpful if reshape_info also returned the new cursor position. The rest can be handled on the languageserver side.
The text was updated successfully, but these errors were encountered:
After implementing this, I learned that LSP doesn't actually support this yet. It won't be rolling out until the next release.
With the new LSP capability, a replacement can be provided as a snippet, using $0 to indicate the final cursor location after inserting the snippet.
Although codegripcould return this snippet text to simplify things, I think it would be better that it return the cursor position (perhaps as number of characters into the replacement?), and then let the LSP escape other $'s and insert this special $0 string.
One potential downside of this for editors like helix or vim, is that you probably don't want cursor positioning handled exactly like a snippet if you're in normal mode. I'm assuming most modal editors would drop you into edit mode for stepping through snippet tabstops, but in this case you probably want to be left in whatever mode you issued the code-action in. Will probably wait to see what it looks like after 3.18 rolls out before speculating further.
That makes sense, happy to return more info such as cursor position.
Regarding editor modality, I guess the LSP clients in these editors should decide what to do in that case? In my experience (vscodevim, emacs evil) it's fine to do snippet transforms in normal state without dropping in insert state.
Currently, after issue only a "change" action from the LSP, the entire region of replaced text is selected after the code action. Instead, it would be more intuitive if the same cursor remained selected through the transformation, mapping its original position to its final position.
To support this, it would be helpful if
reshape_info
also returned the new cursor position. The rest can be handled on thelanguageserver
side.The text was updated successfully, but these errors were encountered: