Skip to content

feat(notes): open notes like the Explorer and add Open Preview - #101

Merged
dionmunk merged 1 commit into
masterfrom
feat/open-like-explorer
Oct 7, 2026
Merged

dionmunk merged 1 commit into
masterfrom
feat/open-like-explorer

Conversation

@dionmunk

@dionmunk dionmunk commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Notes always opened with showTextDocument, which forces the text editor. It ignored VS Code's workbench.editorAssociations, so Markdown associated with the preview or another Markdown editor still opened as text (#10, #53), and an image in Notes failed to open at all (#70).

Changes

  • Notes open like they do from the Explorer (vscode.open), from the tree and from List Notes, with the editor VS Code associates with their file type. A newly created note still opens as text, ready to type in.
  • Open Preview in the right-click menu of a Markdown note, the same entry the Explorer has (the Explorer has no "Open Preview to the Side" in its menu). A tree item doesn't get the resourceLangId context the Explorer uses, so Markdown notes have their own context value, markdownNote, and every note menu entry now matches both note and markdownNote.
  • The file types VS Code knows move into src/languages.ts, read once and again when extensions change, and are shared by new notes (feat(notes): keep an extension typed with a new note's name #96) and the tree.

What I checked first

A probe extension in VS Code 1.140 opened the same files each way and read the editor kind from the tab API:

showTextDocument (before) vscode.open (now)
Markdown, default settings text editor text editor
Markdown, "*.md": "vscode.markdown.preview.editor" text editor Markdown preview
PNG fails: "File seems to be binary" image viewer

A path-limited association ("**/my-notes/**/*.md") opened notes in the preview and left a project README.md as text.

Testing

  • npm test: 30 passing.

  • End to end in VS Code 1.140 on macOS:

    Scenario default settings Markdown associated with the preview
    click a Markdown note text editor preview
    click a PNG image viewer image viewer
    Alt+L, Enter on a Markdown note text editor preview
    right-click a Markdown note Open Preview, Rename Note, Delete Note, Move To..., Reveal same
    right-click a .txt note no Open Preview same
    Open Preview "Preview checklist.md" same
    New Note text editor text editor
  • Rename, Delete, Move To and Reveal from the right-click menu, Move To into a subfolder, an open note following a move, dragging a note to the editor, New Note/New Folder with a note selected, and List Notes were re-run with the same results.

Refs #10, #53, #70. Not closing them here: #10 asks for clicking a note to open its preview, which now works through workbench.editorAssociations but has no Notes setting yet, and #70 also covers PDFs, which need a PDF viewer extension.

Notes always opened with showTextDocument, which forces the text editor: it
ignored workbench.editorAssociations, so Markdown associated with the preview
or another editor still opened as text (#10, #53), and an image failed to open
at all (#70).

- notes open with vscode.open, like the Explorer, from the tree and List
  Notes; a new note still opens as text, ready to type in
- Open Preview in the right-click menu of a Markdown note, as the Explorer
  has; a tree item gets no language context, so Markdown notes have their own
  context value and the note menu entries match both
- the languages VS Code knows move to their own module, read once and again
  when extensions change, and are shared by new notes and the tree
@dionmunk
dionmunk merged commit 92ed9ed into master Oct 7, 2026
1 check passed
@dionmunk
dionmunk deleted the feat/open-like-explorer branch October 7, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant