vscode-favorites
vscode-favorites copied to clipboard
relative to $(workspaceRoot)
Favorites are stored with absolute paths. I wish it is possible to add favorite relative to workspaceRoot. In that case moving/renaming project and/or working on the same project on different computers (with different paths) would work.
Solution would be to use paths relative to vscode variable ${workspaceRoot}
I have the same need, when I sync a project with others and the workspace path is different all favorites are not working, inside the json i noticed there are two fields that remain null even if i edit manually: workspaceRoot and workspacePath
{
"type": "File",
"name": "c:\\Wamp\\www\\testsite\\routes\\web.php",
"parent_id": null,
"fsPath": "c:\\Wamp\\www\\testsite\\routes\\web.php",
"workspaceRoot": null,
"workspacePath": null,
"id": "SswrZzXBEHy92d5q"
}
However, as you can see here ${workspaceRoot} is deprecated
In my case the .code-workspace file is inside the www folder, I tried a lot of possibilities setting paths relatives to ${workspaceFolder} but none of them worked
I was just looking to do the same. After taking a look into the current plugin code to see how it sets up its paths, I managed to make it work for me:
- "name": "path/to/folder/or/file/relative/to/workspace/root/without/leading/or/ending/slash"
- "fsPath": null
- "workspaceRoot": null
- "workspacePath": null
@AcidGreg I tried this, not working though. Here are my settings settings.json
"favorites.storageRegistry": [
"/Users/username/favorites.json",
],
favorites.json
{
"type": "File",
"name": "/Users/username/Documents/notes.md",
"parent_id": null,
"fsPath": null,
"workspaceRoot": null,
"workspacePath": null,
"id": "5EM2LpqXfIiBybvm"
}
@mifas
"name": "/Users/username/Documents/notes.md",
That path does not seem to be relative to the workspace. ;-) I only tried it with a relative path, as I wanted the whole thing to be portable.
bummer, @AcidGreg idea seemed promising, but when i populate the name property with relative path and fsPath with null and then hit the "Refresh List" button, it repopulates fsPath and the error message when clicking a file still appears as if it's still going after absolute path... maybe this behavior changed since another release? FYI the current release i'm on looks like v2.4.5 from the VS Marketplace (which doesn't coincide with latest v2.3.0 in this repo's releases).