terrortylor / nvim-comment

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

Feat: ignore trailing whitespace in commentchars #48

Closed smjonas closed 2 years ago

smjonas commented 2 years ago

Before this change the following line could not be uncommented in a Lua file (even though it is a commented line) because the commentstring for Lua files is --%s:

--local fn = vim.fn

After this change the line will be uncommented to local fn = vim.fn, as expected.

Let me know if you would prefer a setting for this behavior instead that users can opt-out from.

terrortylor commented 2 years ago

Hi, This would change the current behaviour, although actually be useful.

Running your code there are failing tests, on line 87 you check the length of the match result, but this could be nil, so needs some safety checks there.

As this changes current behaviour, this should be wrapped in a config value, that defaults to "false". i.e. opt-in

With those changes then we can merge.

smjonas commented 2 years ago

Hey, thanks for the feedback. I'm not interested in finishing this PR anymore :smile: If you or someone else wants to finish it feel free to reopen and use my code :)