Skip to content

feat(notes): keep an extension typed with a new note's name - #96

Merged
dionmunk merged 1 commit into
masterfrom
feat/note-extensions
Oct 7, 2026
Merged

dionmunk merged 1 commit into
masterfrom
feat/note-extensions

Conversation

@dionmunk

@dionmunk dionmunk commented Oct 7, 2026

Copy link
Copy Markdown
Owner

A new note always got the default extension, so query.sql became query.sql.md, starting with a # query.sql heading (#81).

Changes

  • New Note keeps a typed extension when it's one a note can have: listed in notes.notesExtensions, or, with the default *, one VS Code has a language for. That list comes from every installed extension's language contributions, plus plain text (.txt), which VS Code's core registers itself rather than an extension. The .07 of Meeting 2026.10.07 isn't a language, so that name stays whole and gets the default extension.
  • Only Markdown notes start with a heading, and it leaves out the extension (# plan for plan.md). A heading would make a new .json or .sql file invalid. People whose default extension is txt now get an empty file instead of a # Title line.
  • Rename uses the same rule, which fixes two bugs with the default *:
    • renaming a.md to a.txt failed with "'a.md' already exists", because * was compared as if it were an extension and the typed one was swapped back
    • renaming to a name with dots lost its last part: Meeting 2026.10.07 became Meeting 2026.10.md
    • a note without an extension (README) had its whole name treated as its extension; it now renames as typed

Testing

  • npm test: 29 passing, 3 new tests for splitting a typed name.

  • End to end in VS Code 1.140 on macOS:

    You type master this branch
    New Note query.sql query.sql.md with # query.sql query.sql, empty
    New Note data.json data.json.md with # data.json data.json, empty
    New Note list.txt list.txt.md list.txt, empty
    New Note plan.md plan.md.md plan.md with # plan
    New Note Meeting 2026.10.07 Meeting 2026.10.07.md same
    Rename a.md to a.txt "'a.md' already exists" a.txt
    Rename to Meeting 2026.10.08 Meeting 2026.10.md Meeting 2026.10.08.md
    Rename README to README2 not checked README2
    notesExtensions: md,txt, New Note query.sql not checked query.sql.md, so it shows in the tree
    default extension txt, New Note todo not checked todo.txt, empty

    The master column for query.sql, data.json, a.txt and the dotted rename comes from the same scenarios run against master; list.txt and plan.md follow from the same code path.

  • New Note in both sections, the "where should it go" question, and New Note/New Folder with a note selected were re-run with the same results.

Closes #81.

A new note always got the default extension, so `query.sql` became
`query.sql.md` (#81). A typed extension is now kept when it is one a note can
have: in notes.notesExtensions, or with `*` one VS Code has a language for. The
`.07` of `Meeting 2026.10.07` isn't, so that name stays whole. Languages come
from every installed extension, plus plain text, which VS Code registers itself.

Only Markdown notes start with their name as a heading; a heading would make a
new .json or .sql file invalid.

Rename uses the same rule, which fixes two bugs with the default `*`: renaming
`a.md` to `a.txt` failed with "already exists", since `*` was compared as an
extension, and a name with dots lost its last part (`Meeting 2026.10.md`). A note
without an extension no longer gets its whole name appended as one.
@dionmunk
dionmunk merged commit 20aa46c into master Oct 7, 2026
1 check passed
@dionmunk
dionmunk deleted the feat/note-extensions branch October 7, 2026 06:01
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.

Could we enable custom file extensions when creating new notes?

1 participant