tagbar icon indicating copy to clipboard operation
tagbar copied to clipboard

Modifications for jsctags.

Open mohitleo9 opened this issue 7 years ago • 3 comments

Hey, I have run into an issue with jsctags (which probably surprises nobody!) So the problem is that when tagbar runs jsctags on the file it creates a tmp copy of the file for the tags. But for jsctags to work properly it needs a .tern-project file with the --dir option. (otherwise it tries to infer the .tern-project file location based on current file path which in this case will be /tmp/something.) So a solution could be one of following.

  1. run jsctags at the current location of file (and let it find the .tern-project) or 2. figure out where the .tern-project is and pass it with --dir option

mohitleo9 avatar Sep 08 '17 18:09 mohitleo9

I can make a PR if either one of the approaches seems good.

mohitleo9 avatar Sep 08 '17 18:09 mohitleo9

I think the second approach would be better, otherwise you lose the advantages of the current approach like being able to use Tagbar for netrw-opened files.

Since it's not unlikely that there will be other cases where more dynamic changes to a type configuration might be needed, my first idea would be to add a new key to the type configuration dictionary with a funcref to a callback function. That function would then be called every time a file is processed and gets passed the file path and the current type configuration, and then it can make any changes to the type config it wants. This would be a bit similar to the currently existing project-specific autocommand support. The best place to call that callback function would probably right after this line, so that the user-specified project autocommands would have the last say.

majutsushi avatar Sep 13 '17 06:09 majutsushi

@mohitleo9 Did you ever work out a configuration for jctags you liked?

Or is this issue obsolete now that Universal Ctags has Javascript support?

alerque avatar Dec 03 '19 09:12 alerque