This day’s code includes a bunch of refactoring, some cleanup of regressions introduced yesterday, a new help authoring command and a reminder to self that when it’s late at night in Devember and you’re busy writing code and you still have a devlog post to write, you should probably not distract yourself by writing a forum post to answer a question someone asked eighteen days ago.
In any case, here’s an update on what happened today.
Before my nightly coding got started in earnest, I discovered some problems with some changes made last night and as a result over the last couple of days as well, so I fixed those when I probably should have been doing my end of year performance review (a dreaded task if ever there was one).
Particularly, the key bindings for auto pairing of help elements were broken in that I forgot to go back and include a scope selector that restricts them to happening only in help files, which I noticed when asterisks started auto pairing in weird cases.
While I was testing that I realized that I also added a regression to the syntax for links last night when I put in the restriction on leading tabs. I forgot to change the match length of the second group (where tabs are allowed) which resulted in links being forced to be at least two characters in length. While I was at it I also modified links to not allow the inclusion of an asterisk, since those are used to define anchors and as such can’t appear in anchor text.
I also added a change that I created last night about 4 seconds after I clicked post on last night’s devlog, in which I said that I know of no way to mask the key binding in the command palette and was sad that the entry for showing the table of contents was showing a key that only works in some contexts. In fact I do know a way to do that. The command palette shows you the key binding associated with a command if it happens to have the same name and arguments.
So by modifying the command palette to specifically say that it should not be prompting for a package if one is missing, the entry gets hidden when it’s not valid (because the command disables itself), and since the key entry doesn’t need to specify that because it’s context makes it only take effect inside of a help file anyway, the two use different arguments and so the shortcut key doesn’t appear in the command palette. Simple and neat.
Next up was an experimental change in how the help view focuses on navigation points. The view has to change locations to show you text whenever you navigate between anchors with the Tab key, and it needs to focus the view on an anchor when you follow a link to it.
Previously it always tried to center the target location in the help view, but now it only does that when you follow a link. If you’re just skipping between anchors inside the current file the navigation scrolls more conservatively (or not at all) to keep things visible with some context but without focusing it in the center of the window. This seems to make the view less “twitchy”, so we’ll see what happens as testing progresses.
After this it was time to try to actually create some help files, wherein I decided that the best thing to do was create at least one help authoring command to be able to more easily create a help file from scratch, since the only way to do that currently would be to create a help file with a header in it, then save and re-open it to get Sublime to set the syntax.
After a whole bunch of refactoring of existing code, there is now an authoring command that will prompt you for the name of a help file and then create a stub help file for you. The help is assumed to be in the same package as the current help file, but you will be prompted for the package to use if there is not a help file open or you specifically request to be prompted.
The new authoring command also invokes a snippet to insert the help file header and let you enter the title and a date (which defaults to the current date), so you can get up and running quickly. In the future this will also tie the help file into the help index for you so that you can actually view the help, but that is a ways down the road (probably not within the Devember time frame) since it requires a more complex syntax for the index files.
With that, this day of Devember draws to a close and I drag myself off to bed.