Closed msva closed 1 month ago
I ran into this same issue and did some debugging. The issue is here: https://github.com/JoosepAlviste/nvim-ts-context-commentstring/blob/1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee/lua/ts_context_commentstring/internal.lua#L118-L123
The issue happens when language_config
is a string and node_type
is the name of a string method e.g., char
. Then doing language_config[node_type]
returns the string function like so:
("")["char"] -- returns the string.char() function
The reason this only breaks sometimes is because if the node_type
doesn't match the name of a string method then lua returns nil
as expected:
("")["notastringmethod"] -- returns nil
Hey! Thanks for the debugging @1dr0z, that was exactly what was happening. It's especially noticeable if you use the autocmd because then we're constantly re-calculating the commentstring
.
I've pushed a commit fixing this: https://github.com/JoosepAlviste/nvim-ts-context-commentstring/commit/9c74db656c3d0b1c4392fc89a016b1910539e7c0 and will close this issue.
Let me know if this wasn't fixed or comes up again!
Hi there! Unfortunatelly, I'm unable to prepare minimal-reproducible config for the issue, I'm experience, so I need help in investigation.
If I set
enable_autocmd
insetup{}
totrue
, I'm getting strange error when I open some file types (like "dockerfile" or "sh")The error is:
It seems like setting
enable_autocmd
is not enough by itself, and maybe something in my config is related as well, because it does not reproduce with minimal config from this repo.But still, it reproduces every time with my config (if this option is enabled). And I'm not sure, what plugins/settings shuld I look for to add to the repro-config to make error reproduce there.
Can you give some advices? Or, maybe, another ideas of the reasons why
match
can become a function instead of a table there?