helix icon indicating copy to clipboard operation
helix copied to clipboard

"Remove `dbg!` macro" code action for Rust

Open tgross35 opened this issue 1 year ago • 3 comments

VSCode has a very useful action to remove dbg! macros:

image

Helix doesn't seem to have the same option:

image

I think this is in RA rather than VSCode directly https://github.com/rust-lang/rust-analyzer/blob/dba59970bcccfb3c6fc16ea0d0d79da875f22316/crates/ide-assists/src/lib.rs#L362, is it possible to expose in Helix?

helix 23.10 (f6021dd0)

tgross35 avatar Feb 15 '24 03:02 tgross35

I am able to get this macro when I fully select the dbg! call but not when my cursor is in the range, which is probable because here: https://github.com/rust-lang/rust-analyzer/blob/dba59970bcccfb3c6fc16ea0d0d79da875f22316/crates/ide-assists/src/handlers/remove_dbg.rs#L25 they check if there is no selection but we always have a selection that we send

gabydd avatar Feb 15 '24 04:02 gabydd

Hm, the only extra options that show up for me are the usual refactoring options. Does yours only work in certain circumstances?

image

tgross35 avatar Feb 15 '24 05:02 tgross35

Sorry you need to select the whole call so what's inside the () as well plus the last )

gabydd avatar Feb 15 '24 06:02 gabydd

I am able to get this macro when I fully select the dbg! call but not when my cursor is in the range, which is probable because here: https://github.com/rust-lang/rust-analyzer/blob/dba59970bcccfb3c6fc16ea0d0d79da875f22316/crates/ide-assists/src/handlers/remove_dbg.rs#L25 they check if there is no selection but we always have a selection that we send

Are there lots of rust-analyzer features that do this? How much convenience are we missing out on by always sending a selection?

Edit: looks like there's a handful

image

willhansen avatar Mar 03 '24 15:03 willhansen