Respect Markdown Viewer setting for .md links in AI rules/facts panel#9699
Merged
vorporeal merged 1 commit intowarpdotdev:masterfrom May 4, 2026
Merged
Conversation
Contributor
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I reviewed this pull request and requested human review from: @warpdotdev/oss-maintainers. Comment Powered by Oz |
Contributor
There was a problem hiding this comment.
Overview
This PR routes AI rules/facts panel file opens through the existing file-target resolution path so Markdown viewer, editor choice, and layout settings are respected consistently with terminal output links.
Concerns
- No blocking correctness or security concerns found in the changed hunk.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
…facts panel Closes warpdotdev#8998. `Workspace::handle_ai_fact_view_event` was calling `self.open_code` directly for `AIFactViewEvent::OpenFile`, which always routes the file into the Warp Code Editor and ignores `EditorSettings::prefer_markdown_viewer` along with the user's `open_file_editor` choice. The same path is reachable from `RuleViewEvent::OpenFile` (`app/src/ai/facts/view/mod.rs:132-133`), which re-emits the same event, so both surfaces showed the same regression: a `.md` file path clicked in the AI rules/facts panel opens in the code editor (or terminal at the parent directory) instead of the Markdown Viewer even when the user has explicitly enabled it. Switch the handler to compute a `FileTarget` via `resolve_file_target_with_editor_choice` and dispatch through `Workspace::open_file_with_target`, which already has the per-target branches for `MarkdownViewer`, `EnvEditor`, `CodeEditor`, and `SystemGeneric`. This is the same pattern used at `view.rs:6424` (open new tab config) and `view.rs:19882` (toast file open), and matches how `Terminal::open_file_path` (`terminal/view.rs:17061`) already routes file-link clicks from terminal blocks.
1eced97 to
fbc0a1c
Compare
Contributor
|
oh boy thanks github |
wolverine2k
pushed a commit
to wolverine2k/warp
that referenced
this pull request
May 5, 2026
…warpdotdev#9699) Closes warpdotdev#8998. ### Description Clicking a `.md` file link in the agent conversation / AI rules / AI facts panel was opening the Warp Code Editor (or a new terminal at the parent directory) even when the user had enabled **Settings → Features → General → Open Markdown files in Warp's Markdown viewer by default**. The same setting was already respected for `.md` links inside terminal output blocks. ### Root cause `Workspace::handle_ai_fact_view_event` (`app/src/workspace/view.rs:5618`) handled `AIFactViewEvent::OpenFile` by calling `self.open_code(CodeSource::Link { … })` directly. `open_code` always routes the file into the Warp Code Editor — it never consults `EditorSettings::prefer_markdown_viewer` or `open_file_editor`. The buggy path is also reachable from `RuleViewEvent::OpenFile`, which `app/src/ai/facts/view/mod.rs:132-133` re-emits as `AIFactViewEvent::OpenFile`, so the rules and facts panels share the regression. The terminal-block path uses a different (correct) routing chain: `Terminal::open_file_path` (`app/src/terminal/view.rs:17061`) calls `resolve_file_target` and emits `Event::OpenFileWithTarget`, which the workspace then dispatches through `Workspace::open_file_with_target` — that helper has explicit branches for `MarkdownViewer`, `EnvEditor`, `CodeEditor`, `SystemGeneric`, and `ExternalEditor`. The AI panels were skipping all of that. ### Fix In the `AIFactViewEvent::OpenFile` arm: 1. Compute the appropriate `FileTarget` via `resolve_file_target_with_editor_choice` (already imported in the file at `view.rs:111`), feeding in `open_file_editor`, `prefer_markdown_viewer`, and `open_file_layout` from `EditorSettings`. 2. Dispatch through `Workspace::open_file_with_target` with `CodeSource::Link { … }` as the source — same shape used by the existing `view.rs:6424` (tab-config-template open) and `view.rs:19882` (toast file-open) call sites. That single change covers both `RuleViewEvent::OpenFile` and `AIFactViewEvent::OpenFile` because they converge on the same handler. ### Testing - `cargo fmt -p warp -- --check` — passes. - `cargo check --features=gui --bin=warp-oss` — passes (full re-check after edit). - `cargo nextest run --features=gui -p warp -E 'test(test_resolve_file_target_markdown_viewer_precedence) | test(test_resolve_file_target_warp_uses_default_layout) | test(test_resolve_file_target_binary_is_system_generic) | test(test_resolve_file_target_binary_uses_env_editor)'` — **4 tests run: 4 passed**, including `test_resolve_file_target_markdown_viewer_precedence` which directly covers the `.md + prefer_markdown_viewer = true → FileTarget::MarkdownViewer` decision this fix relies on. ### Server API - [ ] Yes - [x] No ### Agent Mode - [ ] Yes - [x] No ### Changelog Entries `CHANGELOG-BUG-FIX`: Clicking a `.md` file link from the AI rules/facts panel now opens it in Warp's Markdown Viewer when "Open Markdown files in Warp's Markdown viewer by default" is enabled, matching the behaviour for terminal output block links. Co-authored-by: anshul-garg27 <[email protected]>
Leejaywell
pushed a commit
to Leejaywell/warp
that referenced
this pull request
May 5, 2026
…warpdotdev#9699) Closes warpdotdev#8998. ### Description Clicking a `.md` file link in the agent conversation / AI rules / AI facts panel was opening the Warp Code Editor (or a new terminal at the parent directory) even when the user had enabled **Settings → Features → General → Open Markdown files in Warp's Markdown viewer by default**. The same setting was already respected for `.md` links inside terminal output blocks. ### Root cause `Workspace::handle_ai_fact_view_event` (`app/src/workspace/view.rs:5618`) handled `AIFactViewEvent::OpenFile` by calling `self.open_code(CodeSource::Link { … })` directly. `open_code` always routes the file into the Warp Code Editor — it never consults `EditorSettings::prefer_markdown_viewer` or `open_file_editor`. The buggy path is also reachable from `RuleViewEvent::OpenFile`, which `app/src/ai/facts/view/mod.rs:132-133` re-emits as `AIFactViewEvent::OpenFile`, so the rules and facts panels share the regression. The terminal-block path uses a different (correct) routing chain: `Terminal::open_file_path` (`app/src/terminal/view.rs:17061`) calls `resolve_file_target` and emits `Event::OpenFileWithTarget`, which the workspace then dispatches through `Workspace::open_file_with_target` — that helper has explicit branches for `MarkdownViewer`, `EnvEditor`, `CodeEditor`, `SystemGeneric`, and `ExternalEditor`. The AI panels were skipping all of that. ### Fix In the `AIFactViewEvent::OpenFile` arm: 1. Compute the appropriate `FileTarget` via `resolve_file_target_with_editor_choice` (already imported in the file at `view.rs:111`), feeding in `open_file_editor`, `prefer_markdown_viewer`, and `open_file_layout` from `EditorSettings`. 2. Dispatch through `Workspace::open_file_with_target` with `CodeSource::Link { … }` as the source — same shape used by the existing `view.rs:6424` (tab-config-template open) and `view.rs:19882` (toast file-open) call sites. That single change covers both `RuleViewEvent::OpenFile` and `AIFactViewEvent::OpenFile` because they converge on the same handler. ### Testing - `cargo fmt -p warp -- --check` — passes. - `cargo check --features=gui --bin=warp-oss` — passes (full re-check after edit). - `cargo nextest run --features=gui -p warp -E 'test(test_resolve_file_target_markdown_viewer_precedence) | test(test_resolve_file_target_warp_uses_default_layout) | test(test_resolve_file_target_binary_is_system_generic) | test(test_resolve_file_target_binary_uses_env_editor)'` — **4 tests run: 4 passed**, including `test_resolve_file_target_markdown_viewer_precedence` which directly covers the `.md + prefer_markdown_viewer = true → FileTarget::MarkdownViewer` decision this fix relies on. ### Server API - [ ] Yes - [x] No ### Agent Mode - [ ] Yes - [x] No ### Changelog Entries `CHANGELOG-BUG-FIX`: Clicking a `.md` file link from the AI rules/facts panel now opens it in Warp's Markdown Viewer when "Open Markdown files in Warp's Markdown viewer by default" is enabled, matching the behaviour for terminal output block links. Co-authored-by: anshul-garg27 <[email protected]>
Leejaywell
added a commit
to Leejaywell/warp
that referenced
this pull request
May 5, 2026
Cherry-picked from upstream: - fix: highlight C++ header extensions (warpdotdev#9388) - Run executable shell scripts in the terminal (warpdotdev#9503) - Revert schema generator binary recompilation fix (warpdotdev#9676) - Remove stray backticks from Windows installer README (warpdotdev#9691) - Fix chord shortcuts on Windows non-Latin keyboard layouts (warpdotdev#9476) - Scroll output with Page Up/Down from prompt (warpdotdev#9624) - Respect Markdown Viewer setting for .md links in AI rules/facts panel (warpdotdev#9699) - fix: disable reset grid checks for restored blocks on Windows (warpdotdev#9987) - add RedirectionGuard=no to windows-installer.iss (warpdotdev#9863) - Windows quake mode window correctly sized (warpdotdev#9891) - fix: update rand to 0.9.4 (GHSA-cq8v-f236-94qc) (warpdotdev#10060) - Fix diff button when Show code review button toggle is off (warpdotdev#9600) - Fix freshly cloned repo stuck in loading state (warpdotdev#9998) - Fix terminal text selection not auto-scrolling when dragging (warpdotdev#9448) - Resolve conflict markers from 3f0ac51 and edac651
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.
Closes #8998.
Description
Clicking a
.mdfile link in the agent conversation / AI rules / AI facts panel was opening the Warp Code Editor (or a new terminal at the parent directory) even when the user had enabled Settings → Features → General → Open Markdown files in Warp's Markdown viewer by default. The same setting was already respected for.mdlinks inside terminal output blocks.Root cause
Workspace::handle_ai_fact_view_event(app/src/workspace/view.rs:5618) handledAIFactViewEvent::OpenFileby callingself.open_code(CodeSource::Link { … })directly.open_codealways routes the file into the Warp Code Editor — it never consultsEditorSettings::prefer_markdown_vieweroropen_file_editor. The buggy path is also reachable fromRuleViewEvent::OpenFile, whichapp/src/ai/facts/view/mod.rs:132-133re-emits asAIFactViewEvent::OpenFile, so the rules and facts panels share the regression.The terminal-block path uses a different (correct) routing chain:
Terminal::open_file_path(app/src/terminal/view.rs:17061) callsresolve_file_targetand emitsEvent::OpenFileWithTarget, which the workspace then dispatches throughWorkspace::open_file_with_target— that helper has explicit branches forMarkdownViewer,EnvEditor,CodeEditor,SystemGeneric, andExternalEditor. The AI panels were skipping all of that.Fix
In the
AIFactViewEvent::OpenFilearm:FileTargetviaresolve_file_target_with_editor_choice(already imported in the file atview.rs:111), feeding inopen_file_editor,prefer_markdown_viewer, andopen_file_layoutfromEditorSettings.Workspace::open_file_with_targetwithCodeSource::Link { … }as the source — same shape used by the existingview.rs:6424(tab-config-template open) andview.rs:19882(toast file-open) call sites.That single change covers both
RuleViewEvent::OpenFileandAIFactViewEvent::OpenFilebecause they converge on the same handler.Testing
cargo fmt -p warp -- --check— passes.cargo check --features=gui --bin=warp-oss— passes (full re-check after edit).cargo nextest run --features=gui -p warp -E 'test(test_resolve_file_target_markdown_viewer_precedence) | test(test_resolve_file_target_warp_uses_default_layout) | test(test_resolve_file_target_binary_is_system_generic) | test(test_resolve_file_target_binary_uses_env_editor)'— 4 tests run: 4 passed, includingtest_resolve_file_target_markdown_viewer_precedencewhich directly covers the.md + prefer_markdown_viewer = true → FileTarget::MarkdownViewerdecision this fix relies on.Server API
Agent Mode
Changelog Entries
CHANGELOG-BUG-FIX: Clicking a.mdfile link from the AI rules/facts panel now opens it in Warp's Markdown Viewer when "Open Markdown files in Warp's Markdown viewer by default" is enabled, matching the behaviour for terminal output block links.