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

Text object selections for Top Level Form (aF,iF) #33

Merged

Conversation

Olical
Copy link
Contributor

@Olical Olical commented Sep 23, 2023

Could maybe do with more methods and tests, but this is already working and the tests are passing. I haven't checked visual selections yet, I presume I will need to add more functions and mappings for that.

The general tree sitter / selection code seems to be working though. I might also refactor this a bit to reuse code between the "current form" and "top level form" functions. There's a lot of overlap there but I thought I'd take the simple copy/paste approach first.

Also I went with "top level" to describe this concept, in my tooling I call it "root" but you already have terms for root and I didn't want to muddy those waters.

Could maybe do with more methods and tests, but this is already working
and the tests are passing.
@Olical Olical force-pushed the add-top-level-form-operations branch from 79a54b3 to a4b224a Compare September 23, 2023 13:29
@Olical
Copy link
Contributor Author

Olical commented Sep 23, 2023

Okay, code deduplicated and another test for visual selections added. Let me know what you think / what you'd like to change! And feel free to just take this and run with it if you want to make changes of course 😄

I hope this helps!

See #12 for more information about this feature. (for future readers / people without context)

Copy link
Owner

@julienvincent julienvincent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking the time to add this! This is a great improvement with a very clean implementation.

I like the "top level form" terminology too :)


-- If we call this function on "Sub-node 2" we expect "Branch B" to be
-- returned, the top level one below the document itself. We know which
-- node is the document because it lacks a parent, just like Batman.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦇

@julienvincent julienvincent merged commit df1c7b8 into julienvincent:master Sep 25, 2023
1 check passed
@julienvincent julienvincent changed the title Initial pass with top level form selection and deletion Text object selections for Top Level Form (aF,iF) Sep 25, 2023
@Olical
Copy link
Contributor Author

Olical commented Sep 25, 2023

I'm glad you like it! And thanks for building this great plugin, it's a really nice framework to extend.

(so thankful that this is lua, I can't bring myself to contribute / work with VimL these days at all 😬 )

@julienvincent
Copy link
Owner

I'm glad you like it! And thanks for building this great plugin, it's a really nice framework to extend.

You're welcome 🤗 It's the least we can do in exchange for Conjure ;)

(so thankful that this is lua, I can't bring myself to contribute / work with VimL these days at all 😬 )

I know! My aversion to VimL was a large factor in why this project even happened! Haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants