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

feat(comment): commentstring hook for more control #28852

Closed
wants to merge 1 commit into from

Conversation

ribru17
Copy link
Contributor

@ribru17 ribru17 commented May 19, 2024

Problem: it's difficult for users to customize the inbuilt commenting behavior (changing or extending)

Solution: expose a hook that can override the selected commentstring, to allow for finer control

Closes #28830

Problem: it's difficult for users to customize the inbuilt commenting
behavior (changing or extending)

Solution: expose a hook that can override the selected commentstring, to
allow for finer control

Closes neovim#28830
@clason
Copy link
Member

clason commented May 19, 2024

The limitations were deliberate, for the sake of maintenance and documentation. There are enough plugins out there for people who want more control.

(Not shutting this down, but there's a high bar to clear for adding functionality.)

In particular, it was one of the requirements to not expose any API on this module.

@ribru17
Copy link
Contributor Author

ribru17 commented May 19, 2024

Ah, damn. That's fair; I'll wait for someone else to close if they choose to. Maybe someone will come up with a good alternative in the meantime

more accurate comments in JSX-family files (assuming the appropriate
|treesitter| parser has been installed): >lua

require('vim._comment').cs_hook = function(row, col)
Copy link
Member

Choose a reason for hiding this comment

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

"hook" is not a name used anywhere else in vim/nvim. Use existing names/conventions, to help discoverability.

This would typically be modeled as an "event" (autocmd) or a callback (on_foo).

@justinmk
Copy link
Member

#28830 (comment) gives a more likely alternative. Adding random hooks on top of the already numerous extension points is too much. 'commentstring' should be fixed instead. This PR doesn't explain why 'commentstring' isn't sufficient.

@justinmk justinmk closed this May 21, 2024
@wookayin wookayin added the closed:wontfix current behavior is by design, and change is not desired label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed:wontfix current behavior is by design, and change is not desired
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inbuilt comment feature not working properly for JSX files
4 participants