Add configurable editor command and open-file shortcut#43
Merged
cpojer merged 2 commits intoJun 3, 2026
Conversation
Adds configurable editor command support and a Mod+k open-file shortcut while keeping CODIFF_EDITOR as the override. Moves config defaults to a packaged-safe shared JSON source so Electron and the renderer cannot drift or depend on excluded src files at runtime.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR centralizes Codiff’s default configuration into a shared JSON file (used by both Electron and the renderer) and adds support for opening the currently selected file in an external editor via a configurable editor command and a new keybinding.
Changes:
- Added
settings.editorCommandandkeymap.openFileto config/types and JSON schema/defaults. - Moved default config values to
config/defaults.jsonand introducedcreateDefaultConfig()in both renderer and Electron. - Implemented “Open File in Editor” via
Mod+Kand enhanced editor launching with{file}/{repo}placeholders, plus new tests.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Extends preferences type to include editorCommand. |
| src/lib/app-constants.ts | Removes in-app default preferences now that defaults come from shared config. |
| src/config/types.ts | Adds editorCommand and openFile keymap action types. |
| src/config/defaults.ts | Loads shared JSON defaults and exposes a default-config factory. |
| src/config/codiff-config.schema.json | Documents and provides schema defaults for new settings/keybinding. |
| src/tests/config-defaults.test.ts | Ensures schema/electron/renderer defaults stay in sync and package includes config. |
| src/tests/App-render.test.tsx | Adds coverage for the Mod+K open-file shortcut behavior. |
| src/App.tsx | Wires openFile command + keybinding handler and uses createDefaultConfig(). |
| package.json | Packages config/ so defaults ship with the npm package. |
| electron/main/editor.cjs | Adds config-driven editor command parsing + {file}/{repo} placeholders. |
| electron/main.cjs | Passes configured editor command and repo context into editor opener. |
| electron/config.cjs | Switches Electron defaults to the shared config/defaults.json and adds new fields to merge. |
| electron/tests/editor.test.ts | Adds tests for configured editor command precedence and placeholder expansion. |
| config/defaults.json | Introduces shared default settings and keymap (including editorCommand + openFile). |
| README.md | Documents new config fields and keybinding in example config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Clarifies editor command examples with quoted placeholders and freezes exported renderer defaults so callers cannot mutate the shared JSON import.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds config support for choosing which editor opens files from Codiff. For example, to open the repo in Sublime Text and edit the currently selected file:
"editorCommand": "subl {repo} {file}".This also adds a default
Mod+kshortcut to open the currently selected file in the configured editor. The shortcut uses the existing keymap config, so users can customize it like the other shortcuts.Config defaults are now centralized in
config/defaults.json, a packaged-safe shared source used by Electron and the renderer. This keeps the editor setting, shortcut defaults, schema defaults, package contents, and runtime defaults from drifting.Changes
settings.editorCommandto config.keymap.openFilewith defaultMod+k.CODIFF_EDITORas the environment override.{repo}resolves to the repository root.config/defaults.json.configin package files.Validation
vp check --fixvp test src/__tests__/config-defaults.test.ts src/__tests__/App-render.test.tsx electron/__tests__/editor.test.tsvp buildpnpm pack --pack-destination /tmp/codiff-npm-pack-checkconfig/defaults.json./srcexcluded.config/defaults.jsonandelectron/config.cjs.electron/config.cjsloads and returns the expected defaults.--user-data-dir; it stayed running until timeout with no stderr.