A few weeks ago, I implemented syntax highlighting for markdown in aretext, the minimalist vim clone I’ve been building. Like most context-sensitive languages, markdown is difficult to parse. Although it handles only a subset of the CommonMark 0.30 spec,1 my implementation required 845 lines of Go code.
Parsing is especially tricky because the code needs to handle any document a user might open. It can’t crash or enter an infinite loop.
A while back, I described an idea for a CLI tool to find definitions in Go projects, and now I’ve built it! I also gave it a shorter name: “gospelunk”, as in “spelunk through some Go code.” It’s similar in spirit to ctags, except that gospelunk understands Go dependencies and can re-index a large project in seconds instead of minutes.
The project is open-source under the MIT license and available on GitHub.
Starting a two week vacation today, so I’ve planned a small project: a Go-specific version of ctags. I’ve used ctags in the past to navigate a medium-sized Go monorepo, but there were some pain points. Re-indexing usually took about a minute, and, at least by default, ctags doesn’t search the standard library or Go module dependencies. I’m imagining a tool that’s easy to use from the CLI as well as from within an editor like vim or aretext.