swift-book
swift-book copied to clipboard
Generate a tags file for navigation while editing
The output uses using the POSIX ctags syntax, and enables "jump to definition" for DocC links and for syntactic categories in the formal grammar. From testing with a few different editors, here's what I saw:
- In Vim, you have to configure
setlocal iskeyword+=#,:,-
to allow those characters as part a tag. Then both links and grammar works. Classicvi
supports tag files, but doesn't haveiskeyword
, so othervi
-like editors might not be able to follow tags. - In BBedit, links work without configuration changes. I wasn't able to get grammar to work, likely because it doesn't consider
-
as part of a tag. - Emacs has support for tags files, but it seems to need a module or configuration change to handle the ctags syntax instead of its preferred etags syntax.
- Xcode uses its own indexing for navigation, not a tags file.
Marking this as a draft for now. I'd like to consider rewriting the script in Swift.