Added
- Which-key auto-resolves Obsidian command names for
:obcommandmappings — when a key is mapped to:obcommand <id><CR>or:ob <id><CR>without an explicitdesc, the which-key popup now displays Obsidian's native command name instead of the raw ex command string. For example,:ob app:go-back<CR>displays as "Navigate back". Explicitdescoptions still take priority. Unknown command IDs fall back to the raw string. Descriptions are automatically localized — Obsidian's built-in commands already have localized names, so descriptions match the user's Obsidian language setting. Works in both editor which-key (leader bindings,vim.keymap.set) and global which-key (:gmap,vim.obsidian.keymap.set). (#62)- Plugin:
src/ui/which-key.ts(lookupObsidianCommandName(),resolveObCommandDescription(),OB_COMMAND_RHS_REregex matching both literal spaces and<Space>notation),src/ui/global-which-key.ts(describeAction()obcommand resolution)
- Plugin:
Changed
- Consolidated Obsidian internal API access into
src/util/utilities — extracted typed accessor functions for 6 internal Obsidian APIs, replacing ~40 inline(x as unknown as { ... })casts across 16 files. Each utility centralizes the unsafe cast in one location and exposes a clean typed function:src/util/commands.ts:executeCommand(app, id),getCommandRegistry(app)— 20 casts across 11 filessrc/util/editor.ts:getEditorView(view)— extracts CM6EditorViewfromMarkdownView, replacing 6 inline casts across 5 filessrc/util/leaf.ts:getLeafId(leaf),isLeafPinned(leaf),getViewFilePath(view),getViewFileBasename(view)— 12 casts across 3 filessrc/util/metadata.ts:getResolvedLinks(app)— 2 casts across 2 filessrc/util/vault.ts:getVaultConfig(app, key),isBuiltinVimEnabled(app)— 4 casts across 4 filessrc/util/keymap.ts:pushKeymapScope(app, scope),popKeymapScope(app, scope)— 3 casts in 1 file
Tests
- 22 unit tests in
test/unit/which-key.test.ts:lookupObsidianCommandName()(4 tests),describeKeymapEntry()without app (6 tests),describeKeymapEntry()with app and obcommand auto-resolution (12 tests covering:ob/:obcommandshort/long form,<CR>variants,<Space>separator, unknown commands, label priority, edge cases) - 6 e2e tests in
test/specs/which-key-obcommand.e2e.ts: editor which-key auto-resolution for:oband:obcommand(2 tests), explicitdescpriority (1 test), unknown command fallback (1 test), global which-key auto-resolution via registry API (1 test), global unknown command fallback (1 test)
Full Changelog: 0.53.0...0.54.0