c0r73x / neotags.nvim

Tag highlight in neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No highlight of C tags

opened this issue · comments

Work only default highlight for C language.
User-defined types and macroses aren't highlighted.

My config:
let g:neotags_enabled = 1
let g:neotags_highlight = 1
let g:neotags#c#order = 'cgstuedfpm'
let g:neotags#cpp#order = 'cgstuedfpm'

Other plugins:
NerdTree
ctrlp
tagbar

Have you added c in the C language in ctags? because if you specify kinds that the language dont have in the order then it wont highlight.

ctags --list-kinds=c
d  macro definitions
e  enumerators (values inside an enumeration)
f  function definitions
g  enumeration names
h  included header files
l  local variables [off]
m  struct, and union members
p  function prototypes
s  structure names
t  typedefs
u  union names
v  variable definitions
x  external and forward variable declarations [off]
z  function parameters inside function definitions [off]
L  goto labels [off]
D  parameters inside macro definitions [off]

Example of problematic code:
#define VFIFO_SIZE_RX_BT (1024)
#define VFIFO_SIZE_TX_BT (1024)
#define VFIFO_ALERT_LENGTH_BT (20)

ATTR_ZIDATA_IN_NONCACHED_RAM_4BYTE_ALIGN static uint8_t g_bt_cmd_tx_vfifo[VFIFO_SIZE_TX_BT];
ATTR_ZIDATA_IN_NONCACHED_RAM_4BYTE_ALIGN static uint8_t g_bt_cmd_rx_vfifo[VFIFO_SIZE_RX_BT];

I don't see highlight of defines in array definition. My config of neotags I described above.

If that limitation of ctags we can close issue, because navigation works fine and I'll just continue search way to get good syntax highlight.

I've noticed a very annoying problem lately that I can't quite explain. It seems some highlight definitions, particularly anything done in one's .vimrc file or similar, are being cleared or overridden by the default settings. That is not supposed to happen.

I'm not sure if this is necessarily related to your problem though. Remember that there must be highlighting definitions in place in addition to telling ctags what to look for. Example:

    highlight link neotags_GlobalVarTag	CMember

The problem I mentioned initially is that these definitions aren't working anymore. I spent an inordinate amount of time trying to trace just when and why this is happening before giving up. There's a workaround though. Define some function with your definitions and an autocmd to force them to be defined.

    function s:WhyWontYouJustWork()
        highlight! link goConstantTag               Enum
        highlight! link goGlobalVarTag              GlobalVarTag
        highlight! link goInterfaceTag              tag_highlight_ClassTag
        highlight! link pythonGlobalVarTag          Enum
        highlight! link rustMacroTag                newClassColor
        highlight! link tag_highlight_ClassTag      newClassColor
        highlight! link tag_highlight_ClassTag      newClassColor
        highlight! link tag_highlight_EnumTag       Enum
        highlight! link tag_highlight_FunctionTag   CFuncTag
        highlight! link tag_highlight_GlobalVarTag  GlobalVarTag
        highlight! link tag_highlight_MemberTag     CMember
        highlight! link tag_highlight_MethodTag     Method
        highlight! link tag_highlight_ModuleTag     Namespace
        highlight! link tag_highlight_NamespaceTag  Namespace
        highlight! link tag_highlight_TemplateTag   newTemplateColor
        highlight! link tag_highlight_OverloadedOperatorTag  OverloadedOperator
    endfunction

    augroup THLFixup
        autocmd VimEnter * call s:WhyWontYouJustWork()
    augroup END

This is my setup for my new plugin (ahem: available here "https://github.com/roflcopter4/tag-highlight.nvim"), and some of the targets are custom. Apologies, but I don't use neotags anymore. It's similar enough to get the point across though.