nvim-treesitter-textobjects icon indicating copy to clipboard operation
nvim-treesitter-textobjects copied to clipboard

feat(c_sharp) add @assignment support for all possible assignable statements

Open prashanthsp6498 opened this issue 1 year ago • 2 comments

Supports for all assignment statements.

Lambda Method

    public static string Method() => $"return result";

class/struct/record fields

    const int CONST_FIELD = 10;
    public static Node head;
    public static Node tempHead = new Node();

local variables declarations

    int count = 10;
    int[] arr = new int[] {1, 2, 3, 4, 5, 6};
    head = new Node{data = arr[0]};
    count = 100;

Above local fields also support in field scope

prashanthsp6498 avatar Nov 22 '24 11:11 prashanthsp6498

Any update on this PR...

prashanthsp6498 avatar Dec 03 '24 15:12 prashanthsp6498

@prashanthsp6498 Hi, sorry for the delay. C# is not a language I personally use and I find it time-consuming to test all query PRs.
Could you kindly add some test cases?

  1. Make an example C# file in tests/select/c_sharp/* (the same as the description is fine)
  2. The assignment textobjects are not defined in the scripts/minimal_init.lua. Add bindings for ig (@assignment.inner), ag (@assignment.outer), ik (@assignment.lhs), iv (@assignment.rhs). The k and v refers to key and value.
  3. Write tests/select/c_sharp_spec.lua similar to the one in python. Make sure you write clear comments to indicate what the test is doing. a. For example, I would equality-compare commands like vt=bd (delete everything before = sign, except for the spaces) with dig and dik. All three commands should produce equal results. Make the default vim command robust and easy to understand (e.g. avoid v10ld because it's easy to be broken when the reference file changes a bit.)

@clason I think this should be mandatory in all query PRs. It's hard to really keep track of all queries manually.

kiyoon avatar Dec 04 '24 05:12 kiyoon