I saw this blogpost by Atlassian, and said to myself, man wouldn't it be nice if I could jump to code in Bitbucket server. Then I realized, I do it locally every day with Ctags, I bet I could integrate it into Bitbucket Server!
What it does
Jump to definitions in your source right in the browser by pressing CTRL, just like an IDE! Jump to class definitions, variables, and functions. Configurable and robust so that you can control what branches and repositories are indexed. Ctags is used for all indexing, so all languages supported by Ctags is supported.
How I built it
I built a back-end which listens for repository changes and then queues Ctags indexing jobs. The tags are then stored in within Bitbucket's database using ActiveObjects. A rest API is then used by the front-end to query for all tags and displayed when you click.
Challenges I ran into
Interfacing with Ctags was generally difficult. I was stumped on how to update tags for the repository without re-indexing the whole thing, but then I realized that I only have to re-index each file that changes.
Interfacing with Bitbucket's source view was also difficult, because Code Mirror's interface isn't public.
Accomplishments that I'm proud of
- I wrote this plugin in a week :).
- The plugin is threaded, so it can handle multiple indexing jobs at once.
What I learned
- Interfacing with the command line in Bitbucket.
- Interfacing large amount of database writes with ActiveObjects.
- Code Mirror's API.
What's next for Code Navigation for Bitbucket
- Language level optimizations
- More configurable options like show on hover.