project_panel: Add markdown preview context menu item (#57112)

Opening a markdown file from the project panel used to require four
steps:
- click the file (opens raw editor)
- right-click the editor tab
- select "Open Markdown Preview"
- then close the raw editor tab

This PR shortcuts that to a single right-click (or keypress) from the
project panel.

Right-clicking a markdown file in the project panel now shows an **Open
Markdown Preview** option. Selecting it opens the rendered markdown
preview directly — no raw editor tab is left behind. The same shortcut
used in the editor (Cmd+Shift+V on macOS, Ctrl+Shift+V on Windows/Linux)
also works when focus is in the project panel.

## How it works

- **Context menu**: `OpenMarkdownPreview` action is registered and
surfaced in the right-click menu only for `.md`/`.markdown` files.
- **Keybinding**: `cmd-shift-v` / `ctrl-shift-v` bound to
`project_panel::OpenMarkdownPreview` in the `ProjectPanel` context,
mirroring the existing editor binding.
- **Loading**: The file is opened via `open_path_preview` with
`focus_item: false, activate: false`, so the raw editor is loaded into
the buffer system but never becomes the visible tab.
- **Preview construction**: `MarkdownPreviewView::create_markdown_view`
is called directly (no `dispatch_action` indirection, which would have
been deferred and caused a race). The preview is added to the active
pane and the raw editor tab is removed atomically in one synchronous
pane update.
- **Pre-existing tabs**: Before loading, all panes are checked for an
existing item at the file's project path. If the file is already open in
raw mode, `remove_item` is skipped — the existing tab is left untouched.

Release Notes:

- Added "Open Markdown Preview" context menu item to Project Panel
markdown entries.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Co-authored-by: Tom Houlé <tom@tomhoule.com>
db30c67ed2Eli Stark committed on 6/26/2026, 12:30:51 PM· committed by GitHubparenteb87750
4 files changedLine totals unavailable