Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap nodes #4

Open
calebeby opened this issue Dec 14, 2024 · 1 comment
Open

Swap nodes #4

calebeby opened this issue Dec 14, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@calebeby
Copy link

Hey, thanks for this plugin! I'm coming from https://github.com/ziontee113/syntax-tree-surfer which is unmaintained. This is the exact replacement I was looking for!

It would be amazing if your plugin would have the ability to move/swap nodes on the same level like syntax-tree-surfer could. For example, to swap list items in markdown files, even if the list items are more than one line long and have nested content.

Totally ok if you aren't interested in this feature but I thought I'd put it out there.

Thanks again for this really awesome plugin!

@aaronik aaronik added the enhancement New feature or request label Dec 14, 2024
@aaronik
Copy link
Owner

aaronik commented Dec 14, 2024

Oh wow I sure am thinking about this a lot now! I mean, this thing does identify the nodes, it wouldn't be hard at all to swap them..

aaronik added a commit that referenced this issue Dec 19, 2024
Smooth going until one major problem:

In order to swap nodes, we need to know how big they are.
We have the jump targets down pat, but knowing how big the current
node is is not easy. Because it's not obvious what the current node
is, only where its start position is.

- This is the commit message #2:

Iteration. Not working, but code structure is there

- This is the commit message #3:

Continuing iteration

Currently it's looking at lines. It's not working fully,
          something wrong in the swap logic. But it's looking at lines.
          It might be nice to do this by nodes, so instead of
          highest_coincident starting on the same line, looking at
          the highest coincident on the same line and col. And
          swapping like that as well.

- This is the commit message #4:

Pilfer ts_util's swap_nodes
aaronik added a commit that referenced this issue Dec 19, 2024
Smooth going until one major problem:

In order to swap nodes, we need to know how big they are.
We have the jump targets down pat, but knowing how big the current
node is is not easy. Because it's not obvious what the current node
is, only where its start position is.

- This is the commit message #2:

Iteration. Not working, but code structure is there

- This is the commit message #3:

Continuing iteration

Currently it's looking at lines. It's not working fully,
          something wrong in the swap logic. But it's looking at lines.
          It might be nice to do this by nodes, so instead of
          highest_coincident starting on the same line, looking at
          the highest coincident on the same line and col. And
          swapping like that as well.

- This is the commit message #4:

Pilfer ts_util's swap_nodes
aaronik added a commit that referenced this issue Dec 20, 2024
Smooth going until one major problem:

In order to swap nodes, we need to know how big they are.
We have the jump targets down pat, but knowing how big the current
node is is not easy. Because it's not obvious what the current node
is, only where its start position is.

- This is the commit message #2:

Iteration. Not working, but code structure is there

- This is the commit message #3:

Continuing iteration

Currently it's looking at lines. It's not working fully,
          something wrong in the swap logic. But it's looking at lines.
          It might be nice to do this by nodes, so instead of
          highest_coincident starting on the same line, looking at
          the highest coincident on the same line and col. And
          swapping like that as well.

- This is the commit message #4:

Pilfer ts_util's swap_nodes
aaronik added a commit that referenced this issue Dec 21, 2024
Smooth going until one major problem:

In order to swap nodes, we need to know how big they are.
We have the jump targets down pat, but knowing how big the current
node is is not easy. Because it's not obvious what the current node
is, only where its start position is.

- This is the commit message #2:

Iteration. Not working, but code structure is there

- This is the commit message #3:

Continuing iteration

Currently it's looking at lines. It's not working fully,
          something wrong in the swap logic. But it's looking at lines.
          It might be nice to do this by nodes, so instead of
          highest_coincident starting on the same line, looking at
          the highest coincident on the same line and col. And
          swapping like that as well.

- This is the commit message #4:

Pilfer ts_util's swap_nodes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants