1

I'd like to generate a set of tags and then view them in Treemacs, ideally whenever I open a file that I can generate tags for.

The docs for Treemacs' tag view say:

Treemacs is able to display not only the file system, but also tags found in individual files. The tags list is sourced using emacs’ builtin imenu functionality, so all file types that emacs can generate an imenu index for are supported.

Imenu caches its result, so to avoid stale tag lists setting imenu-auto-rescan to t is recommended. Tags generated with the help of semantic-mode are likewise supported.

I looked around and it appears that js-mode does offer imenu support.

I'm at a loss for how to actually connect these two - how do I get js-mode to create the imenu index so that treemacs can actually use it?

2

js2-mode generates an imenu index that Treemacs displays.

| improve this answer | |
  • I'm sorry for the total noob questions, but - how do I get js2-mode to generate the imenu? Once it's generated does Treemacs automatically display that? (If so - how does Treemacs know to look for the imenu?) – MikeTheTall Dec 9 '19 at 21:23
  • The imenu generation should happen automatically. You can see it in treemacs by putting point on, say, a js file and hitting TAB -- it will show the items it found in that file such as variables, functions, etc. – sandinmyjoints Dec 10 '19 at 20:49
  • 1
    Hey, that worked! Thanks for the help! – MikeTheTall Dec 11 '19 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.