Skip to content

C extensions tags update #26

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

C extensions tags update #26

wants to merge 1 commit into from

Conversation

bruno-
Copy link
Contributor

@bruno- bruno- commented Jun 7, 2015

Hi,
I'm playing with ruby C extensions + browsing ruby source (also related to tpope/rbenv-ctags#5) and I notice an issue: after tags are used once to jump to ruby source or include dir, vim's tags option looses tags for ruby C source.

This is a bummer, because the majority of C functions or macros "exposed" to users via ruby.h almost always delegate to some internal ruby functions.. So in most cases a single tags jump is not enough.

I compared how this works when editing ruby files and then making a tags jump to ruby std lib. In this case tags option is handled nicely.

This PR contains a proof of concept solution for the problem: if a user opens a ruby C extension file an autocmd is registered (once). While vim's cwd is inside a ruby project, path and tags options for C files will be updated.

Feedback is appreciated!

@tpope
Copy link
Owner

tpope commented Jun 7, 2015

I did something vaguely similar in fireplace.vim and it was a huge pain. My advice would be not to activate all of rake.vim; copy 'path' and 'tags' only. Something vaguely like seems like it would work while being pretty conservative:

au FileType c,cpp
      \ if !empty(getbufvar('#', 'rake_root')) && getbufvar('#', '&filetype') =~# '^\%(c\|cpp\)$' |
      \   let &l:path = getbufvar('#', '&path') |
      \   let &l:tags = getbufvar('#', '&tags') |
      \ endif

@bruno-
Copy link
Contributor Author

bruno- commented Jun 7, 2015

Thanks for the pointer, the PR is updated.

Please note that aside from copying l:path and l:tags we also have to carry around the b:rake_root variable in ruby source C files.

Other than that I've tested this and things work.

@tpope
Copy link
Owner

tpope commented Jun 7, 2015

Yeah I don't like the sound of that. After that rbenv-ctags request is ready I'll play with it more myself.

@bruno-
Copy link
Contributor Author

bruno- commented Jun 7, 2015

All right, thanks for that.

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.

2 participants