preservim / tagbar

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

Comments starting with # within sh/shell code is included in the menu #832

Closed lpyparmentier closed 1 year ago

lpyparmentier commented 1 year ago

Hello,

If I'm writing some shell code within the following balise ```sh ...```, and I'm including some shell comments with #, it is included in the menu of tagbar (thinking its a chapter) while it should not.

I did not find any related issue? and I'm not sure if it's related to tagbar plugin or with ctags ?

Laurent

raven42 commented 1 year ago

what is the file extension? is ctags / vim recognizing it as the correct file type as a shell script? When I attempt to do a similar shell script, I do not see this behavior (at least while I am providing the correct file extension).

For example, here is one script I have. Note in the bottom right of the status line, the file type is recognized as sh denoting this is a shell script: image

lpyparmentier commented 1 year ago

Sorry @raven42 I wasn't explicit enough, i'm talking about having a .md file. See below:

image

that's it ! shouldn't be a chapter.

raven42 commented 1 year ago

Ah ok. Yes this is a markdown file type. Ctags will recognize the # marker as a section header. See the ctags markdown documenation for more details.

There is nothing in tagbar we could really do about this. It is part of universal ctags that is picking this up.

You could open a ticket against Universal Ctags that it is incorrectly interpreting a comment inside ``` shell invocation markers. Once ctags gets updated with this, then tagbar would no longer show it.

lpyparmentier commented 1 year ago

That's what I thought, thanks :)