Repository navigation
fix(notes): resolve a relative location against a portable VS Code's folder - #94
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Change
In a portable VS Code, a relative
notes.notesLocationis resolved against the folder holding VS Code, sodata\Notesis theNotesfolder inside its portable data folder and the notes travel with it.VSCODE_PORTABLEto 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 (datain the program folder on Windows and Linux,code-portable-datanext 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.notes.workspaceNotesLocationstays relative to the workspace folder.Testing
npm test: 22 passing, 2 new tests.A portable VS Code 1.140 on macOS (a
code-portable-datafolder next to the app), withnotes.notesLocationset toportable-notes: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.