nvim-code-action-menu icon indicating copy to clipboard operation
nvim-code-action-menu copied to clipboard

Diff contains a lot of garbage

Open ColonelPhantom opened this issue 3 years ago • 2 comments

Thank you for this plugin, I generally like it very much! I did however run into an issue with the built-in diff capability. I created an Asciinema recording to demonstrate: https://asciinema.org/a/TuSubUEB3xRAZUPmoBFoggqtW

As you can see, the diff for "replace match with if let" is huge, even though it just replaces 4 lines by 3 others.

The language server used is rust_analyzer.

ColonelPhantom avatar Feb 11 '22 00:02 ColonelPhantom

Happening with me as well. Diffs are probably the best feature of this plugin. But it sometimes shows a lot of garbage, mainly repeatedly showing the same changes. It also shows wrong line numbers in diff(off by one). I have noticed this issue in rust_analyzer and sumneko_lua. Here's an example with rust_analyser:

fn main() {
    let x = 15;
}

In this function calling CodeActionMenu on any of let, x and 15 shows some possible code actions. On x and 15 its working fine. But on let only one of the two possible code actions is telling diff properly. Here's what the second diff shows. It is repeating the difference. The line numbers are also wrong. Though I have noticed that the line numbers are consistently wrong everywhere. Is this some king of convention which I dont know of?

Similar issues arise with sumneko_lua and probably other LSP's as well

AbheetChaudhary avatar Mar 08 '23 20:03 AbheetChaudhary

Some quick debug printing shows that rust-analyzer issues a lot of edits, many of which are on the same lines. And this plugin does not deal with this properly

algmyr avatar Mar 10 '23 17:03 algmyr