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

Allow addition of new language types (#789) #792

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

Conversation

jhradilek
Copy link

This is an attempt to resolve #789 and re-enable support for addition of a new language definition from within vim configuration without having to edit ~/.ctags.

With this patch, if you need to define a language that is unknown to ctags and provide a custom file with deffile as documented in doc/tagbar.txt, you can use deflang as follows:

let g:tagbar_type_asciidoc = {
  \ 'ctagstype': 'asciidoc',
  \ 'deflang': 'asciidoc',
  \ 'deffile': expand('<sfile>:p:h:h') . '/ctags/asciidoc.cnf',
  \ 'sort': 0,
  \ 'kinds': [
    \ 's:Table of Contents',
    \ 'i:Included Files',
    \ 'I:Images',
    \ 'v:Videos',
    \ 'a:Set Attributes',
    \ 'A:Unset Attributes'
  \ ]
\}

@jhradilek
Copy link
Author

On the off chance this solution gets approved, I'd be of course happy to update docs/tagbar.txt as well.

Comment on lines +1402 to +1404
if has_key(a:typeinfo, 'deflang')
let ctags_args += ['--langdef=' . expand(a:typeinfo.deflang)]
endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might be able to just key off the deffile instead. Then there wouldn't need to be any new config keys. Can you give this a try and see if this works?

Suggested change
if has_key(a:typeinfo, 'deflang')
let ctags_args += ['--langdef=' . expand(a:typeinfo.deflang)]
endif
if has_key(a:typeinfo, 'deffile')
let ctags_args += ['--langdef=' . a:typeinfo.ctagstype]
endif

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.

#777 breaks the ability to add a definition for a new language or file type
2 participants