preservim / tagbar

Vim plugin that displays tags in a window, ordered by scope
https://preservim.github.io/tagbar
Other
6.12k stars 486 forks source link

Error with C++ und global ctags option `--extras=+q` #739

Closed embear closed 3 years ago

embear commented 3 years ago

I have the option --extras=+q in my global ctags configuration file ~/.ctags.d/global_settings.ctags. This option causes an error when opening the tagbar for the following simple C++ code:

struct test {
  test() {};
  ~test() {};
}

The tagbar window is empty and the error output is this

Error detected while processing function tagbar#ToggleWindow[2]..<SNR>290_ToggleWindow[9]..<SNR>290_OpenWindow[81]..<SNR>290_AutoUpdate[86]..<SNR>290_RenderContent[65]..<SNR>290_PrintKinds[21]..<SNR>290_PrintTag[42]..<SNR>290_PrintTag[8]..<SNR>295_strfmt[14]..<SNR>295_getDataType:                                                                                                                                                                                                                                                                                                   
line   18:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
E33: No previous substitute regular expression

I'm using version 2a36ad79a7ed

alerque commented 3 years ago

Just to be sure, can you pull in and test with the latest commit c7e7d5e? The bug it was to fix is a different error but just in the off chance they are related...

raven42 commented 3 years ago

I have been able to confirm this is still an issue. With the --extras=+q option, ctags is outputing additional tags for the fully qualified tag. For cpp destructors, this now means the ~ character is no longer at the start of that particular tag entry. I have a fix ready I'll be pushing up shortly.

Example:

test    test.cpp    /^struct test {$/;" s   line:49 file:   end:52
test    test.cpp    /^  test() {};$/;"  f   line:50 struct:test file:   access:public   signature:()    end:50
test::test  test.cpp    /^  test() {};$/;"  f   line:50 struct:test file:   access:public   signature:()
~test   test.cpp    /^  ~test() {};$/;" f   line:51 struct:test file:   access:public   signature:()    end:51
test::~test test.cpp    /^  ~test() {};$/;" f   line:51 struct:test file:   access:public   signature:()

In this case there is a tag test::~test which is causing the substitution to fail with the ~ character.