leftstick / vscode-favorites

An extension helps developer marking resources as favorite. Therefor, those resources can be easily found at a special view
https://leftstick.gitbooks.io/vscode-favorites/
GNU General Public License v3.0
49 stars 22 forks source link

Feature request: use relative path for workspace favorites #49

Open massimo-cassandro opened 3 years ago

massimo-cassandro commented 3 years ago

Saving a favorite using a workspace-relative path would improve portability and sharing

GitMensch commented 2 years ago

Is the setting favorites.saveSeparated what you were looking for - or do you want an extra setting to specify the path?

massimo-cassandro commented 2 years ago

Now favorites are written in workspace as:

"favorites.resources": [
      {
        "filePath": "/Users/user/absolute/computer/path/my_project/myfile.js",
        "group": "Default"
      }
}

This causes all paths to break if I switch to another computer or if I want to share favorites with other developers. The simplest solution, I mean, is to write workspace-relative paths:

"favorites.resources": [
      {
        "filePath": "myfile.js",
        "group": "Default"
      }
}

where filepath is relative to my project (workspace) path

GitMensch commented 2 years ago

I see, thanks for adding the missing details. I totally agree and second this feature request.

To not break existing environments either relative or absolute paths should be used, so likely a favorites.relativeRessourcePaths would be necessary.

Higurashi-kagome commented 2 years ago

It's also necessary for me because I usually need to push the setting file in the repository to Github and I don't want the setting file to show the disk path information to others.

leftstick commented 2 years ago

Are you mean in workspace mode, right? the settings will be written with abs path as below:

{
    "folders": [
        {
            "path": "test/web-api"
        }
    ],
    "settings": {
        "favorites.resources": [
            {
                "filePath": "/Users/howard/codes/test/web-api/Jenkinsfile.dev.groovy",
                "group": "Default"
            }
        ]
    }
}

In workspace mode, what location do you think can be used as base of the relative path? But true, as you mentioned, the abs path seems not ok to if we push the config file to central store. I will think about this. thanks for you guys suggestion

Higurashi-kagome commented 2 years ago

Yes, it's in workspace mode, and I found a good idea from VSCode:

Details ![image](https://user-images.githubusercontent.com/51501079/170423196-2b9b39c4-b2db-4bdf-98f6-9ed51a89b585.png)

As we can see, VSCode uses the relative path which is relative to the workspace file to save path information.

Higurashi-kagome commented 2 years ago

Yes, it's in workspace mode, and I found a good idea from VSCode:

Details

As we can see, VSCode uses the relative path which is relative to the workspace file to save path information.

But it seems to be useless because the extension has no idea about where the workspace file is...😓