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

refactor: expose common functions in utils, so users can easily code custom text objects #73

Merged

Conversation

stevenxxiu
Copy link
Contributor

Sometimes I want to use text objects that have use cases specific to me.

This exposes common functions used in charwise-textobjs.lua to utils, so users can easily code custom text objects. I think this will make the plugin more useful and flexible.

Checklist

  • Used only camelCase variable names.
  • If functionality is added or modified, also made respective changes to the
    README.md (the .txt file is auto-generated and does not need to be modified).
  • Used conventional commits keywords.

@chrisgrieser
Copy link
Owner

chrisgrieser commented Jan 14, 2024

  1. I am somewhat hesitant to expose these functions, since exposing any sort of API carries the implicit promise of keeping them stable. And since they are somewhat main functions I'd probably work on in the feature, making them subject to change. So at the very least, I'd mark it as unstable, so any potential users are aware of this drawback.
  2. Also, if this were to be merged, it's not good practice to stuff everything into the utils module, especially if it is only going to be used in one module (the charwise objects) anyway. Moreover, has the bad side effect of creating an unnecessarily huge diff in the commit history.
  3. The test is failing, meaning you forgot to run stylua

@stevenxxiu
Copy link
Contributor Author

stevenxxiu commented Jan 14, 2024

  1. Sure I can mark them as unstable. How would you like me to do that? Is there some Lua way of doing it?
  2. Would you like to keep them in lua/various-textobjs/charwise-textobjs.lua then?
  3. I could run StyLua. I just didn't it in this case, since the parts it modified weren't the parts I changed. Would you still like me to run it?

@chrisgrieser
Copy link
Owner

  1. As comment with WARN at the beginning

"Yes" to every question otherwise

@stevenxxiu
Copy link
Contributor Author

I've addressed your points.

@chrisgrieser chrisgrieser merged commit 09a4fb5 into chrisgrieser:main Jan 14, 2024
2 checks passed
@chrisgrieser
Copy link
Owner

👍

@stevenxxiu stevenxxiu deleted the refactor/expose-common-funcs branch January 15, 2024 07:05
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