With the recent integration of the HID format into Genode, I’ve found myself working through many HID files, enjoying the clear and digestible syntax. However, when it came to editing those files in my preferred editor, Emacs, it was less pleasant, partly due to the noticeable lack of syntax highlighting. As far as I can tell, the only editor that has any semblance of support for HID files is Vim. As an Emacs user, I couldn’t let that stand, and I decided to write my own Emacs major mode for HID files. This grew into hid-mode, which performs syntax highlighting on HID files and provides a small set of editing conveniences tailored to the format’s structure.
Syntax highlighting is done through Emacs’ traditional, search-based font-lock method. Emacs provides the rx macro for writing readable regexes, and (finally ) I managed to write a regex that catches all disabled x nodes and their children.
Since HID is fluid in its layout and structure, I implemented custom indentation rules to balance flexibility with the format’s natural flow, though there’s certainly room for improvement. I also added a toggle “gutter” function to quickly create a visual link between nodes, which helps with formatting and readability. Currently, the mode has full syntax highlighting, three indentation modes, and an electric indent replacement that keeps the gutter intact, but the smart indentation is still experimental and multiline constructs require full buffer refontification. In the future, I am looking to add support for using HSD files as the basis for indentation and syntax-highlight rules derived from their configs.
If you want to try it out, you can add it via use-package.
Having Emacs ported over would make it almost perfect for me .
That will probably be my next endeavor, after some preliminary yak-shaving to get goa working with Guix. The fact that Emacs consolidates a lot of application functionality into itself (email, rss, irc, web-browsing) makes it well worthwhile to invest some time in a port. Getting Emacs working would likely open doors for other development tools as well.
After seeing the positive reception to hid-mode, I have decided to branch out and tackle what I would consider to be “IDE features” for those interested.
Flycheck integration for beautify and hid: This is the low-hanging fruit that I am currently working on. I have managed to get both of them working with flycheck, but would like to get machine-applicable fixes working so that more trivial errors can be fixed automatically. Part of this work will probably include enhancing the hid tool itself so that it can produce messages with greater detail (e.g. file:line:col: warning: message). I feel that this meshes quite well with the spirit of building bridges by integrating these tools into the editing workflow, thereby improving the overall UX of working on a Genode project.
WYSIWYG editing for GOSH: A common complaint about the GOSH syntax is that it is virtually unused outside of Genode. Following the familiar cycle of “few users ⇆ few tools”, this means that we are stuck looking at a wall of plain ASCII unless we export it elsewhere to make it look pretty. A WYSIWYG mode for GOSH would make both reading and writing it an equally pleasant experience.
Transient menu for Goa: This one is a little more ambitious, but I am willing to give it a go. Hopefully, you will be able to interact with Goa entirely through the transient UI and have access to all the usual commands but with a more user-friendly interface. It should provide insight into the overall state of a project’s environment (e.g. goa-specific environment variables, variables located in different files, etc.) and generally smooth out the experience by providing abstractions over the workflow, in the hope that future developers are more inclined to give Goa a try.
I am (very slowly) working on menu-driven Goa commands (like your third idea) as a VSCodium extension, but I hadn’t thought of the other two. Those are great ideas also.