cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Bug with arguments and Rust macros

Open bookcasey opened this issue 3 years ago • 3 comments

Cursorless doesn't recognize arguments passed into Rust macros.

If you try to delete 1 using chuck arg 1:

fn main() {
    println!("{}", 1);
}

It fails with the following error: Couldn't find containing argumentOrParameter.

bookcasey avatar Jul 31 '22 21:07 bookcasey

I don't think this is trivial to fix. All we get (unsurprisingly) out of tree-sitter is a token tree:

> source_file
>> function_item
>>> body: block
>>>> expression_statement
>>>>> macro_invocation
>>>>>> token_tree
>>>>>>> integer_literal
>>>>>>> "1"

auscompgeek avatar Aug 01 '22 08:08 auscompgeek

As a workaround, does the item scope do the trick?

auscompgeek avatar Aug 01 '22 08:08 auscompgeek

@auscompgeek good call on "item". We are actually considering switching "arg" to use "item" under the hood, just restricting allowable parent nodes. We'd probably do that as follow-up work to #629

pokey avatar Aug 03 '22 11:08 pokey