Integrate JoosepAlviste/nvim-ts-context-commentstring#165
Integrate JoosepAlviste/nvim-ts-context-commentstring#165
Conversation
JoosepAlviste
left a comment
There was a problem hiding this comment.
Hey @tyru! Something like this seems great. I added a few notes that might help. Once this PR gets merged, I'll make sure to mention the integration in nvim-ts-context-commentstring README :)
| if conft !=# &l:filetype | ||
| if integration ==# 'ts_context_commentstring' | ||
| let old_commentstring = &l:commentstring | ||
| lua require('ts_context_commentstring.internal').update_commentstring() |
There was a problem hiding this comment.
I'm not sure if it helps, but I added another function: calculate_commentstring, which returns the commentstring as a string or nil. The only difference is that it doesn't update the commentstring setting for the buffer. If you'd like, then you can use it with luaeval like so:
let commentstring = luaeval('require("ts_context_commentstring.internal").calculate_commentstring()')
" `commentstring` is either a string or `v:nil`| " Context filetype support. | ||
| " https://github.com/Shougo/context_filetype.vim | ||
| if s:installed_context_filetype | ||
| if integration ==# 'context_filetype' |
There was a problem hiding this comment.
I'm not 100% sure how Shougo/context_filetype.vim works, but I think that a user might use both context_filetype.vim and nvim-ts-context-commentstring (in different files). Some languages like vimscript don't have a treesitter parser, so using context_filetype.vim for those makes sense. Right now, it looks like only one of those integrations would work.
- Add g:caw_integrated_plugin - Add caw#update_comments_from_commentstring()
8197ff9 to
703db47
Compare
JoosepAlviste/nvim-ts-context-commentstring#12
g:caw_integrated_plugincaw#update_comments_from_commentstring()