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

Integrate JoosepAlviste/nvim-ts-context-commentstring #165

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

tyru
Copy link
Owner

@tyru tyru commented Jun 6, 2021

JoosepAlviste/nvim-ts-context-commentstring#12

  • Add g:caw_integrated_plugin
  • Add caw#update_comments_from_commentstring()

Copy link

@JoosepAlviste JoosepAlviste left a comment

Choose a reason for hiding this comment

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

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 :)

autoload/caw.vim Outdated
if conft !=# &l:filetype
if integration ==# 'ts_context_commentstring'
let old_commentstring = &l:commentstring
lua require('ts_context_commentstring.internal').update_commentstring()

Choose a reason for hiding this comment

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

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'

Choose a reason for hiding this comment

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

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()
@tyru tyru force-pushed the integrate-ts_context_commentstring branch from 8197ff9 to 703db47 Compare August 21, 2021 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants