feat(lsp): preserve cursor position for move_item command#532
feat(lsp): preserve cursor position for move_item command#532mrcjkb merged 1 commit intomrcjkb:masterfrom
Conversation
Review ChecklistDoes this PR follow the Contribution Guidelines? Following is a partial checklist: Proper conventional commit scoping:
If applicable:
|
fc3e436 to
85d704b
Compare
| end | ||
| local overrides = require('rustaceanvim.overrides') | ||
| overrides.snippet_text_edits_to_text_edits(result) | ||
| local cursor = extract_cursor_position(result) |
There was a problem hiding this comment.
question: This function does more than just extracting the cursor position, as it also implements the snippet_text_edits_to_text_edits logic.
Can it be reduced to just the single functionality of extracting the cursor position?
Correct me if I'm wrong; I don't think we'll see any meaningful performance gains by looping over the text edits once.
On a related note: I'm wondering if we even need to apply snippet_text_edits_to_text_edits here.
It seems unlikely to me that moving an item would result in a snippet text edit. What do you think?
There was a problem hiding this comment.
question: This function does more than just extracting the cursor position, as it also implements the snippet_text_edits_to_text_edits logic.
Can it be reduced to just the single functionality of extracting the cursor position?
Yes, sorry about that. I just copy-pasted my old PR. Updated now.
On a related note: I'm wondering if we even need to apply snippet_text_edits_to_text_edits here.
It seems unlikely to me that moving an item would result in a snippet text edit. What do you think?
rust-analyzer sends that snippet text edit, nothing we can do here but to patch it for vim.lsp.util.apply_text_edits.
85d704b to
1929605
Compare
Port simrat39/rust-tools.nvim#386