Skip to content

Feature/bug?: working better with nested lists #79

@IndianBoy42

Description

@IndianBoy42
local blah = {
  { 2, 1, 6 },
  { 3, 4, 6 },
  { 3, 4, 6 },
}

If i have nested lists like this, I don't think there is anywhere to place the cursor that would make ISwapWith work with the outer list. In fact, placing the cursor on the braces of one of the inner lists makes iswap think we're trying to work on the inner list (because technically the cursor is contained within the inner list.

Even if this is fixed to work I think the nicer solution is to allow ISwapWith from visual mode and then ISwapWith will try its best to treat the visual range as the cur_node. Basically ignore lists that are contained within the visual range, or if the visual range covers multiple children of a list then we shouldn't operate within that list.

I've actually already started the implementation for a PR but I wanted to post this for discussion and if you agree with the solution?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions