Add Transient menus - #214
Conversation
3 menus currently added: - `gdscript-menu`: the main menu that other menus are accessible from. - `gdscript-menu-godot`: for anything related to the Godot executable. - `gdscript-menu-gdscript`: for anything related to GDScript. History is built-in to transient by including a unique `:history-key`. History is navigatable with `C-x p` `C-x n`. History is setup for `gdscript-menu-godot`. The other menus have no configuration options, so have no use for it. GDFormat commands are greyed out unless the executable is found. There is also the option to make it completely hidden, but that would make the commands less discoverable. I used a shorthand variable `gd//` for transient-specific code. Using a shorthand here has two advantages. 1. Concise code 2. Discourage external use of internal details.
|
I have not removed any hydra code yet as I have not built a replacement for the debug hydra yet. But looking at #211, it seems like the debugger might need some fixes before attempting to overhaul it. I'm pushing this now because, personally I believe these menus surpass the existing hydra for launching godot. It would be good to get some feedback on where I may be wrong. |
|
For the debugging part, basically the godot-debug package can be removed now; it dates back to Godot 3 which didn't support the debugger adapter protocol (DAP). We had to parse the specific data/bytes exchanged with Godot's debugger. Since then DAP became a standard protocol and emacs probably supports it out of the box or with a library. All you should need is define how emacs and godot connect and the rest should be handled by the protocol implementation. Regarding this menu please let me know if/when you'd like me to test and merge it. Transient is built-in now? That's pretty cool, whenever there's a suitable built-in API I definitely prefer using this over external dependencies (unless there's a very strong UX reason to go external, something unsupported by built-ins; today I'd also vendor any external dependencies to be able to inspect all the code involved in the entire package). |
Right so
Not just yet, I'll refactor it slightly now that the
It is indeed 😄
I completely agree
That's what I do locally as well, I've taken to using package-vc with my own forks to review code before I upgrade. (The upcoming Emacs 31 has a feature to view code diffs during package upgrades though, which should make it a lot easier). |
|
Yes the debug package is Godot 3 only. And all the changes to syntax highlighting, for example, are already breaking support for a Godot 3 so the package could completely be removed. Or well if you wanted to take on extra maintenance the codebase could detect the Godot version and branch features for backward compatibility; But personally, I would freeze the Godot 3 version of the package now that Godot 3 does not move much anymore and has very few users, there's little chance there's even 1 Godot 3 user working with Emacs left. And they could use the last compatible version of the extension for Godot 3. |
Features
Main Menu
gdscript-menuA main entry point that we could assign to a key, removing the need to memorise complex keychords. Think of it like a bespoke
which-key-mode.Godot Engine Menu
gdscript-menu-godot:Wrapping a CLI tool is where Transient really shines, if you've used Magit then the way this menu works should be familiar.
Built In History
I've set up this menu to use transient's built-in history: navigatable with
C-x pC-x n.Saves Last Used Flags
Each time you open the menu, it starts with the same flags you used last. This persists across emacs sessions.
GDScript Menu
gdscript-menu-gdscriptConditionally disable GDFormat commands when executable is missing
We could instead hide them completely, but that would make the feature less discoverable.
Additional Notes
Shorthands
I used a Shorthand
gd//for transient-specific code. (Emacs automatically translates this intogdscript-menu--). I've done this for two reasons:Missing Menu options
Script
This option has been left out as it has confused users in the past, including me. This could be reconsidered if we make it clear when it will work (via conditional disabling for instance)
Switch to Godot
This may be a personal taste, but I don't use this option. I just use the familiar
switch-to-bufferif I want to switch buffer. I'd be curious to hear feedback on this one from other users.