Skip to content

fix(notes): resolve a relative location against a portable VS Code's folder - #94

Merged
dionmunk merged 1 commit into
masterfrom
fix/portable-notes-location
Oct 7, 2026
Merged

dionmunk merged 1 commit into
masterfrom
fix/portable-notes-location

Conversation

@dionmunk

@dionmunk dionmunk commented Oct 7, 2026

Copy link
Copy Markdown
Owner

In a portable VS Code, everything lives in VS Code's own folder, and #38 wanted the notes there too, with a relative storage location like data\Notes.

What was wrong

  • In 2.0.0 a relative location was resolved against the extension host's working folder: the notes were listed, but opening them failed.
  • Since fix(notes): stop asking for a storage location once one is set #86 (not released yet) a relative location resolves against the workspace folder, so a portable setup like this can't find its notes at all: "The notes storage location could not be found".

Change

In a portable VS Code, a relative notes.notesLocation is resolved against the folder holding VS Code, so data\Notes is the Notes folder inside its portable data folder and the notes travel with it.

  • VS Code sets VSCODE_PORTABLE to its portable data folder when it runs portable, and deletes it otherwise. The extension uses its parent folder rather than repeating VS Code's own detection, which differs per platform (data in the program folder on Windows and Linux, code-portable-data next to the application on macOS, another layout for versioned updates on Windows). This is from reading VS Code's startup code; I confirmed the extension host sees the variable in a portable VS Code 1.140 on macOS.
  • Outside portable mode nothing changes, and notes.workspaceNotesLocation stays relative to the workspace folder.

Testing

  • npm test: 22 passing, 2 new tests.

  • A portable VS Code 1.140 on macOS (a code-portable-data folder next to the app), with notes.notesLocation set to portable-notes:

    master this branch
    no folder open "could not be found" note listed, opens with its contents
    a workspace open "could not be found" note listed, opens with its contents
  • Not portable: the relative, ~, missing and Workspace Notes scenarios from fix(notes): stop asking for a storage location once one is set #86 and feat(notes): add a Workspace Notes section for per-project notes #93 give the same results as before.

  • Not tested: portable VS Code on Windows or Linux, where the reporter is. The difference there is only where VS Code puts the portable data folder, which it reports through VSCODE_PORTABLE.

Closes #38.

…folder

A portable VS Code keeps everything in its own folder, and #38 wanted the
notes there too, with a relative location like `data\Notes`. Such a path was
resolved against the extension host's working folder, so notes were listed but
didn't open, and since #86 it resolved against the workspace folder instead,
which can't find them at all.

In a portable VS Code, a relative notes.notesLocation is now resolved against
the folder holding it. VS Code sets VSCODE_PORTABLE to its portable data folder
(`data` in the program folder on Windows and Linux, `code-portable-data` next to
the application on macOS), so the extension uses its parent rather than
repeating VS Code's own detection. Outside portable mode nothing changes, and
workspace notes stay relative to the workspace folder.
@dionmunk
dionmunk merged commit 76303ec into master Oct 7, 2026
1 check passed
@dionmunk
dionmunk deleted the fix/portable-notes-location branch October 7, 2026 04:39
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.

Notes don't open if set "Storage location" to the path of the program folder.

1 participant