terrortylor / nvim-comment

A comment toggler for Neovim, written in Lua
MIT License
479 stars 23 forks source link

Add hook functionality, update docs #23

Closed gegoune closed 3 years ago

gegoune commented 3 years ago

Closes #6

gegoune commented 3 years ago

@terrortylor This PR is missing tests. I have never written one before and am not sure how to do that. Some guidance would be really appreciated. Wasn't sure what to call hook setting. Maybe something more descriptive such as pre_comment_hook?

terrortylor commented 3 years ago

Sorry been awol. Sure, take a look at the tests in the tests directory, and the Makefile for how to run. You will need plentary (https://github.com/nvim-lua/plenary.nvim)

Suggestion for a test would be to create a clouse function and set that in the hook that modified a variable local to the test (maybe a counter), comment out some code, toggle it and check that that the variable is modified as expected.

You've some very opinionated readme changes there too ;) (I don't really mind they are all sensible!)

EDIT: Actually a lot of the README style changes seem pointless, and I'm not really on board with them

mvllow commented 3 years ago

Really looking forward to this getting merged, can we just remove any unnecessary doc changes? That should be it's own PR anyways imo.

gegoune commented 3 years ago

Still missing tests, tried to give it a go but never used plenary and wrote tests, do you mind helping out a bit?

terrortylor commented 3 years ago

hey, regarding tests I can help for sure! I'm super busy atm but maybe we can do a pair session? I'll approve and merge for now (looks fine) and then we can arrange a time to go over it together?

gegoune commented 3 years ago

Ah, perfect, that's very nice of you, thanks!