Skip to content

feat: improve macro open file command#994

Merged
chhoumann merged 9 commits intomasterfrom
feature/open-file-command
Nov 19, 2025
Merged

feat: improve macro open file command#994
chhoumann merged 9 commits intomasterfrom
feature/open-file-command

Conversation

@chhoumann
Copy link
Copy Markdown
Owner

@chhoumann chhoumann commented Nov 19, 2025

Summary

  • add explicit open locations (tab/split/window/sidebars) and focus control for macro Open File command, keeping legacy flags compatible via a shared option mapper
  • refresh Open File settings modal (location dropdown, conditional split direction, focus toggle) and use a clearer add-button icon
  • add coverage for option mapping and updated defaults

Testing

  • bun run build-with-lint

Notes

  • Preserves legacy behavior: old openInNewTab=false still opens a new tab; openInNewTab=true without direction splits (vertical).

Summary by CodeRabbit

  • New Features
    • Open File command gains location options (reuse, tab, split with horizontal/vertical, window, left/right sidebar) and a Focus toggle; legacy defaults preserved.
  • UI
    • Settings updated with a location dropdown, conditional split-direction control, Focus toggle, adjusted Save/Cancel layout; Add Open File icon changed to file-search.
  • Refactor
    • Opening logic now uses a centralized helper to build open-file options.
  • Tests
    • Added/updated unit and integration tests covering location and focus behaviors.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented Nov 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
quickadd Ready Ready Preview Nov 19, 2025 9:17pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 19, 2025

Warning

Rate limit exceeded

@chhoumann has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 8 minutes and 26 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 6dc8415 and a3d33f9.

📒 Files selected for processing (4)
  • src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (5 hunks)
  • src/types/macros/QuickCommands/OpenFileCommand.integration.test.ts (2 hunks)
  • src/types/macros/QuickCommands/OpenFileCommand.test.ts (2 hunks)
  • src/types/macros/QuickCommands/OpenFileCommand.ts (1 hunks)

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds optional location and focus fields to open-file commands, introduces buildOpenFileOptions to normalize location/direction/focus with legacy fallbacks, replaces inline option construction in the engine, updates the Open File settings UI, and adds unit/integration tests for the new behavior.

Changes

Cohort / File(s) Summary
Type & Command Model
src/types/macros/QuickCommands/IOpenFileCommand.ts, src/types/macros/QuickCommands/OpenFileCommand.ts, src/types/macros/QuickCommands/OpenFileCommand.test.ts, src/types/macros/QuickCommands/OpenFileCommand.integration.test.ts
Add optional location?: OpenLocation and focus?: boolean to IOpenFileCommand; extend OpenFileCommand constructor and public fields to accept/hold location and focus; update tests to cover new parameters.
Open-file Options Builder
src/engine/helpers/openFileOptions.ts
Add buildOpenFileOptions(command: IOpenFileCommand): OpenFileOptions that maps command.location, command.direction, and command.focus (with legacy fallbacks from openInNewTab/direction) into normalized OpenFileOptions covering reuse, tab, split (direction), window, left-sidebar, and right-sidebar.
Engine Integration & Tests
src/engine/MacroChoiceEngine.ts, src/engine/MacroChoiceEngine.openFileOptions.test.ts
Replace inline open-file options creation with buildOpenFileOptions(command); add unit tests validating explicit and legacy behaviors (reuse, tab, split vertical/horizontal, window, sidebars, focus defaults).
Settings UI
src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts
Replace open-in-new-tab toggle with location dropdown (reuse, tab, split, window, left-sidebar, right-sidebar); add Focus toggle; conditionally show split-direction control; add deriveLocation() and addFocusSetting() helpers; adjust modal button layout.
Minor UI Icon Change
src/gui/MacroGUIs/CommandSequenceEditor.ts
Change icon for "Add Open File command" button to a file-search icon.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant User as User UI
    participant Modal as OpenFileCommandSettingsModal
    participant Cmd as OpenFileCommand
    participant Engine as MacroChoiceEngine
    participant Builder as buildOpenFileOptions
    participant Host as Host File API

    User->>Modal: open settings, choose location/direction/focus
    Modal->>Modal: (if location == split) show direction control
    User->>Modal: Save
    Modal->>Cmd: set command.location, command.focus, command.direction
    Engine->>Builder: buildOpenFileOptions(command)
    Builder->>Builder: normalize location/direction/focus (legacy fallbacks)
    Builder-->>Engine: OpenFileOptions
    Engine->>Host: open file with OpenFileOptions
    Host-->>Engine: result (success/error)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus review on:
    • Correct mapping in buildOpenFileOptions for all OpenLocation values and legacy fallbacks.
    • Constructor changes and public field initialization in OpenFileCommand.
    • UI wiring in OpenFileCommandSettingsModal.ts (deriveLocation, focus toggle, conditional split UI, save/resolve guard).
    • Unit tests in MacroChoiceEngine.openFileOptions.test.ts for coverage and assertions of focus/location.

Poem

🐇
I hopped through tabs and splits so keen,
Chose reuse, window, or a sidebar scene,
Focused or not with a twitch of my nose,
Directions aligned where the soft cursor goes,
A tidy choice garden where every file grows.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing improvements to the macro open file command, including new location options and focus control.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/engine/helpers/openFileOptions.ts Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (2)

56-57: Location / direction UI is good; consider preserving last split direction and tightening types

The new “Where to open” dropdown plus conditional “Split direction” control is a nice, clear UX and the reload pattern is simple.

Two small refinements to consider:

  1. Preserve previous split direction when toggling away and back
    Currently, whenever value !== "split" you clear this.command.direction. That means a user who picks “Horizontal”, switches to “New tab”, then back to “Split” gets reset to “Vertical”. Since direction is ignored when location !== "split" anyway, you could keep the last value for a nicer UX, e.g.:

  •      .onChange((value) => {
    
  •        this.command.location = value as OpenLocation;
    
  •        if (value !== "split") {
    
  •          this.command.direction = undefined;
    
  •        } else if (!this.command.direction) {
    
  •          this.command.direction = NewTabDirection.vertical;
    
  •        }
    
  •        this.reload();
    
  •      });
    
  •      .onChange((value) => {
    
  •        this.command.location = value as OpenLocation;
    
  •        if (value === "split" && !this.command.direction) {
    
  •          this.command.direction = NewTabDirection.vertical;
    
  •        }
    
  •        this.reload();
    
  •      });
    
    
    (Assuming the open‑file engine ignores `direction` unless `location === "split"`.)
    
    
  1. Avoid untyped string literals for OpenLocation values
    All of "reuse", "tab", "split", "window", "left-sidebar", "right-sidebar" are hand‑typed and then cast as OpenLocation. A small typed helper would reduce the chance of drift:

    const locationOptions: { value: OpenLocation; label: string }[] = [
      { value: "reuse",        label: "Reuse active tab" },
      { value: "tab",          label: "New tab" },
      { value: "split",        label: "Split" },
      { value: "window",       label: "New window" },
      { value: "left-sidebar", label: "Left sidebar" },
      { value: "right-sidebar",label: "Right sidebar" },
    ];
    
    new Setting(this.contentEl)
      .setName("Where to open")
      .setDesc("Choose tab, split, window, or sidebar")
      .addDropdown((dropdown) => {
        for (const { value, label } of locationOptions) {
          dropdown.addOption(value, label);
        }
        dropdown
          .setValue(this.command.location ?? this.deriveLocation())
          .onChange((value: OpenLocation) => {
            this.command.location = value;
            if (value === "split" && !this.command.direction) {
              this.command.direction = NewTabDirection.vertical;
            }
            this.reload();
          });
      });

This keeps behavior but improves type safety and UX a bit.

Also applies to: 78-105, 107-120


122-133: Focus toggle behavior is consistent; minor copy tweak optional

The “Focus opened tab” toggle wires cleanly to this.command.focus and uses the same ?? true defaulting as the constructor, so behavior is consistent and respects explicit false.

If you want the label to read naturally for all locations (new window / sidebars as well), consider renaming the setting to something like “Focus opened file” while keeping the description as‑is.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d170dfd and f07db89.

📒 Files selected for processing (9)
  • src/engine/MacroChoiceEngine.openFileOptions.test.ts (1 hunks)
  • src/engine/MacroChoiceEngine.ts (2 hunks)
  • src/engine/helpers/openFileOptions.ts (1 hunks)
  • src/gui/MacroGUIs/CommandSequenceEditor.ts (1 hunks)
  • src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (5 hunks)
  • src/types/macros/QuickCommands/IOpenFileCommand.ts (2 hunks)
  • src/types/macros/QuickCommands/OpenFileCommand.integration.test.ts (2 hunks)
  • src/types/macros/QuickCommands/OpenFileCommand.test.ts (2 hunks)
  • src/types/macros/QuickCommands/OpenFileCommand.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
src/types/macros/QuickCommands/OpenFileCommand.ts (1)
src/types/macros/QuickCommands/IOpenFileCommand.ts (1)
  • IOpenFileCommand (5-14)
src/engine/MacroChoiceEngine.ts (2)
src/engine/helpers/openFileOptions.ts (1)
  • buildOpenFileOptions (4-58)
src/utilityObsidian.ts (1)
  • openFile (450-528)
src/engine/helpers/openFileOptions.ts (1)
src/types/macros/QuickCommands/IOpenFileCommand.ts (1)
  • IOpenFileCommand (5-14)
src/engine/MacroChoiceEngine.openFileOptions.test.ts (2)
src/types/macros/QuickCommands/IOpenFileCommand.ts (1)
  • IOpenFileCommand (5-14)
src/engine/helpers/openFileOptions.ts (1)
  • buildOpenFileOptions (4-58)
src/types/macros/QuickCommands/OpenFileCommand.integration.test.ts (1)
src/types/macros/QuickCommands/OpenFileCommand.ts (1)
  • OpenFileCommand (7-38)
🔇 Additional comments (10)
src/gui/MacroGUIs/CommandSequenceEditor.ts (1)

454-454: LGTM! Clearer icon choice.

The file-search icon better conveys the purpose of opening/finding a file compared to a generic file icon.

src/engine/MacroChoiceEngine.ts (1)

601-603: LGTM! Good refactoring.

Extracting option construction to buildOpenFileOptions improves maintainability and enables easier testing of the option mapping logic.

src/types/macros/QuickCommands/OpenFileCommand.ts (1)

16-37: LGTM! Excellent backward compatibility design.

The constructor maintains backward compatibility while adding explicit location and focus control. The deriveLocation method provides sensible defaults when location is not explicitly provided, mapping legacy flags (openInNewTab and direction) to the new location-based approach.

src/types/macros/QuickCommands/IOpenFileCommand.ts (1)

12-13: LGTM!

The interface extension with optional location and focus fields maintains backward compatibility while enabling the new location-based file opening behavior.

src/engine/MacroChoiceEngine.openFileOptions.test.ts (1)

1-80: LGTM! Comprehensive test coverage.

The tests cover the critical scenarios for option building, including explicit location override, legacy flag fallback behavior, split directions, and focus control.

src/types/macros/QuickCommands/OpenFileCommand.integration.test.ts (1)

36-74: LGTM! Integration tests cover key location-based scenarios.

The tests validate the new location parameter across multiple configurations, including split directions and sidebar placements, while maintaining backward compatibility checks.

src/engine/helpers/openFileOptions.ts (1)

4-58: LGTM! Well-structured option builder.

The function correctly prioritizes explicit location over legacy flags and provides sensible fallbacks. The split direction defaulting to "vertical" (line 19) when not specified is a reasonable choice that prevents undefined behavior.

src/types/macros/QuickCommands/OpenFileCommand.test.ts (1)

7-33: LGTM! Tests validate the new location and focus properties.

The tests correctly verify default behavior (location: "reuse" when openInNewTab is false) and custom configurations with explicit location and focus values.

src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (2)

5-6: Defaulting of location / focus and legacy mapping looks solid

Copying the command and forcing type: CommandType.OpenFile, then backfilling focus and location via deriveLocation() gives a clear contract and good backward compatibility with older openInNewTab/direction-only commands. Nullish coalescing preserves explicit false on focus, and deriveLocation()’s mapping to "reuse" | "tab" | "split" is straightforward and side‑effect free.

No changes requested here.

Also applies to: 18-23, 135-141


148-150: Button bar alignment and guarded save look good

Right‑aligning the buttons with a gap and putting the CTA “Save” to the right of “Cancel” matches common UI conventions. Using resolveWithGuard(this.command) in the Save handler integrates properly with onClose()’s guard, so the promise is resolved exactly once in all paths (Save, Cancel, or direct close).

No issues from a correctness or UX perspective.

Also applies to: 161-168

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f07db89 and 36d6c14.

📒 Files selected for processing (3)
  • src/engine/MacroChoiceEngine.openFileOptions.test.ts (1 hunks)
  • src/engine/helpers/openFileOptions.ts (1 hunks)
  • src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (5 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/engine/helpers/openFileOptions.ts (1)
src/types/macros/QuickCommands/IOpenFileCommand.ts (1)
  • IOpenFileCommand (5-14)
src/engine/MacroChoiceEngine.openFileOptions.test.ts (2)
src/types/macros/QuickCommands/IOpenFileCommand.ts (1)
  • IOpenFileCommand (5-14)
src/engine/helpers/openFileOptions.ts (1)
  • buildOpenFileOptions (4-57)
🪛 GitHub Actions: Test
src/engine/MacroChoiceEngine.openFileOptions.test.ts

[error] 60-60: AssertionError: expected 'split' to be 'tab' // Object.is equality

🪛 GitHub Check: Test (20)
src/engine/MacroChoiceEngine.openFileOptions.test.ts

[failure] 60-60: src/engine/MacroChoiceEngine.openFileOptions.test.ts > buildOpenFileOptions > opens a new tab without splitting when no direction is chosen
AssertionError: expected 'split' to be 'tab' // Object.is equality

Expected: "tab"
Received: "split"

❯ src/engine/MacroChoiceEngine.openFileOptions.test.ts:60:28

🔇 Additional comments (13)
src/engine/MacroChoiceEngine.openFileOptions.test.ts (7)

20-26: LGTM!

Correctly verifies that explicit location takes precedence.


28-35: LGTM!

Correctly validates legacy behavior when openInNewTab: false.


37-44: LGTM!

Correctly validates legacy split behavior with default vertical direction.


46-53: LGTM!

Correctly validates that explicit location: "reuse" overrides legacy openInNewTab flag.


64-75: LGTM!

Correctly validates explicit split with vertical direction.


77-88: LGTM!

Correctly validates explicit split with horizontal direction.


90-97: LGTM!

Correctly validates window location with focus control.

src/engine/helpers/openFileOptions.ts (2)

4-36: LGTM!

The explicit location handling correctly maps all supported location types and properly defaults split direction to vertical when not specified or invalid.


38-56: Legacy mapping preserves old behavior correctly.

The implementation correctly preserves the legacy behavior where openInNewTab: false opens in a new tab (not reuse) and openInNewTab: true splits. The comment at line 45 clarifies this potentially confusing behavior, as the field name openInNewTab: false might suggest reusing the current tab rather than opening a new one.

src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (4)

78-110: LGTM!

The location dropdown implementation is well-structured with typed options and correctly handles the split direction default. The conditional rendering of the direction control (lines 107-109) aligns with the PR objective to show split direction only when relevant.


112-125: LGTM!

Split direction control correctly defaults to vertical, matching the helper's default behavior.


127-138: LGTM!

Focus control implementation correctly defaults to true, matching the helper's default and providing clear user-facing labels as mentioned in the PR objectives.


150-174: LGTM!

Button bar layout is clean with proper spacing and clear CTAs.

Comment thread src/engine/MacroChoiceEngine.openFileOptions.test.ts Outdated
Comment thread src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/engine/MacroChoiceEngine.openFileOptions.test.ts (1)

90-97: Consider adding a test for the default focus behavior.

While the window test verifies explicit focus: false, there's no test confirming that focus defaults to true when undefined, as implemented in the helper (line 4 of openFileOptions.ts).

Add a test case to verify the default:

it("defaults focus to true when not specified", () => {
	const options = buildOpenFileOptions(
		createCommand({ location: "tab" })
	);

	expect(options.focus).toBe(true);
});

Additionally, you may consider:

  • Testing the left-sidebar location for completeness
  • Verifying the mode field is set to "default" in the returned options
  • Testing edge cases like invalid direction values with location: "split" (the helper defaults to "vertical")
src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (1)

78-110: Minor redundancy in location resolution.

The logic is sound and correctly shows/hides the direction setting based on the selected location. However, lines 97 and 107 use this.command.location ?? this.deriveLocation(), but deriveLocation() already checks this.command.location first and returns it if present, making the nullish coalescing redundant.

Apply this diff to simplify:

 			dropdown
-				.setValue(this.command.location ?? this.deriveLocation())
+				.setValue(this.deriveLocation())
 				.onChange((value: OpenLocation) => {
 					this.command.location = value;
 					if (value === "split" && !this.command.direction) {
 						this.command.direction = NewTabDirection.vertical;
 					}
 					this.reload();
 				});
 		});
 
-	if ((this.command.location ?? this.deriveLocation()) === "split") {
+	if (this.deriveLocation() === "split") {
 		this.addDirectionSetting();
 	}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36d6c14 and 0a8cf2a.

📒 Files selected for processing (2)
  • src/engine/MacroChoiceEngine.openFileOptions.test.ts (1 hunks)
  • src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (5 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/engine/MacroChoiceEngine.openFileOptions.test.ts (2)
src/types/macros/QuickCommands/IOpenFileCommand.ts (1)
  • IOpenFileCommand (5-14)
src/engine/helpers/openFileOptions.ts (1)
  • buildOpenFileOptions (4-57)
🔇 Additional comments (9)
src/engine/MacroChoiceEngine.openFileOptions.test.ts (2)

7-17: LGTM!

The createCommand helper is well-structured, providing sensible defaults while allowing flexible overrides for test scenarios.


19-88: Excellent test coverage for core scenarios.

The test cases accurately verify the helper's behavior for explicit locations, legacy mappings, and split directions. The assertions align with the implementation in openFileOptions.ts.

src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (7)

5-6: LGTM!

The new imports are appropriate for the added location and type functionality.


18-22: LGTM!

The initialization correctly ensures the command type is set and provides sensible defaults for legacy commands. The focus default of true aligns with expected UX (users typically want to see the file they opened), and deriveLocation() handles backward compatibility with the legacy openInNewTab flag.


56-57: LGTM!

The display flow correctly calls the new location and focus settings methods, replacing the legacy boolean toggle with more explicit controls.


112-125: LGTM!

The direction setting correctly defaults to vertical when not set, matching the PR's legacy behavior specification (openInNewTab=true defaults to vertical split).


127-138: LGTM!

The focus toggle is straightforward and correctly defaults to true, providing good UX by bringing the opened file to the foreground.


140-146: Past review concern has been resolved!

The deriveLocation() logic now correctly aligns with the helper's behavior:

  • openInNewTab false/undefined → returns "tab" (line 145)
  • openInNewTab true → returns "split" (line 143)

This ensures legacy commands display the correct location in the UI.


150-174: LGTM!

The button bar layout improvements provide better visual hierarchy with the primary action (Save) positioned after Cancel, following common UI patterns.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (1)

78-110: Well-structured location dropdown with comprehensive options.

The location dropdown offers all expected choices with clear labels, and the conditional display of the split direction setting enhances UX.

Minor optimization: Since this.command.location is always backfilled in the constructor (line 22), you can replace this.deriveLocation() calls with direct property access for clarity:

 			dropdown
-				.setValue(this.deriveLocation())
+				.setValue(this.command.location!)
 				.onChange((value: OpenLocation) => {
-	if (this.deriveLocation() === "split") {
+	if (this.command.location === "split") {
 		this.addDirectionSetting();
 	}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a8cf2a and 6dc8415.

📒 Files selected for processing (5)
  • src/engine/MacroChoiceEngine.openFileOptions.test.ts (1 hunks)
  • src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (5 hunks)
  • src/types/macros/QuickCommands/OpenFileCommand.integration.test.ts (2 hunks)
  • src/types/macros/QuickCommands/OpenFileCommand.test.ts (2 hunks)
  • src/types/macros/QuickCommands/OpenFileCommand.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/engine/MacroChoiceEngine.openFileOptions.test.ts
  • src/types/macros/QuickCommands/OpenFileCommand.test.ts
🧰 Additional context used
🧬 Code graph analysis (2)
src/types/macros/QuickCommands/OpenFileCommand.ts (1)
src/types/macros/QuickCommands/IOpenFileCommand.ts (1)
  • IOpenFileCommand (5-14)
src/types/macros/QuickCommands/OpenFileCommand.integration.test.ts (1)
src/types/macros/QuickCommands/OpenFileCommand.ts (1)
  • OpenFileCommand (7-29)
🔇 Additional comments (6)
src/gui/MacroGUIs/OpenFileCommandSettingsModal.ts (3)

18-22: LGTM! Defensive backfill for legacy commands.

The copy-and-backfill pattern correctly ensures legacy commands receive sensible defaults for the new location and focus fields while preserving the original command object.


127-138: LGTM! Clear focus control.

The focus toggle is well-labeled and correctly wired with appropriate defaults.


140-146: LGTM! Logic aligns with helper.

The deriveLocation() logic correctly maps legacy openInNewTab flags to the new location system, matching the behavior of buildOpenFileOptions() as noted in the resolved past review.

src/types/macros/QuickCommands/OpenFileCommand.integration.test.ts (1)

36-72: LGTM! Comprehensive test coverage.

The test configurations thoroughly cover all location types (tab, split, window, sidebars) and verify both legacy compatibility and new functionality. The assertions correctly validate the location field.

src/types/macros/QuickCommands/OpenFileCommand.ts (2)

11-14: LGTM! Property declarations align with interface.

The new location and focus properties are correctly typed and match the IOpenFileCommand interface, maintaining backward compatibility with existing openInNewTab and direction fields.


16-28: LGTM! Backward-compatible constructor extension.

The constructor correctly adds location and focus parameters at the end, maintaining backward compatibility while supporting the new open file options. The focus = true default is consistent with the UI modal's backfill logic.

@chhoumann chhoumann merged commit 9b4f177 into master Nov 19, 2025
4 checks passed
@chhoumann chhoumann deleted the feature/open-file-command branch November 19, 2025 21:22
github-actions Bot pushed a commit that referenced this pull request Dec 9, 2025
# [2.9.0](2.8.0...2.9.0) (2025-12-09)

### Bug Fixes

* honor dateFormat in requestInputs ([903df23](903df23))
* preserve macro user script variable updates ([#999](#999)) ([26a7cf5](26a7cf5))
* reuse current tab when open file new-tab is off ([#1007](#1007)) ([1b67d77](1b67d77))

### Features

* improve macro open file command ([#994](#994)) ([9b4f177](9b4f177))
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 9, 2025

🎉 This PR is included in version 2.9.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant