Markdown preview tabs were lost on restart because `MarkdownPreviewView` implements `Item` and `SearchableItem` but never opted into `SerializableItem`, so the workspace serializer silently skipped it. This change adds persistence, modeled on the existing `ImageView` and `Editor` patterns: - Add a `persistence` submodule storing `(workspace_id, item_id, abs_path, mode)` in a `markdown_previews` table. - `serialize` records the active editor's file path and the preview mode. `deserialize` reopens the file as a buffer and constructs a new `MarkdownPreviewView` around it. - Register the item type in `markdown_preview::init`. Untitled markdown buffers and previews whose source file no longer exists are not restored — `serialize` and `deserialize` return `None` and `Err` respectively, mirroring `ImageView`. `csv_preview` and `svg_preview` have the same `SerializableItem` defect; left out of this PR to keep scope focused. Closes #38581 Part of #7371 Release Notes: - Fixed Markdown preview tabs not being restored when reopening a workspace Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable on the no tests bit, consistent with ImageView, ComponentPreview, GitGraph, TerminalView, and every other SerializableItem impl other than Editor. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
4 files changedLine totals unavailable