microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.96k stars 28.77k forks source link

Recently opened project has the same name #191157

Open yiliang114 opened 1 year ago

yiliang114 commented 1 year ago

ADD ISSUE DESCRIPTION HERE

Version: 1.81.1 Commit: 6c3e3dba23e8fadc360aed75ce363ba185c49794 User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Embedder: vscode.dev

image

lszomoru commented 1 year ago

@bpasero, I think that this falls into your area of ownership.

bpasero commented 1 year ago

These are probably from different branches so maybe the extension should set the recently opened name according to that.

yiliang114 commented 1 year ago

These are probably from different branches so maybe the extension should set the recently opened name according to that.

The branch information will be displayed like this

image

The real reason is that the authority of folderUri are not the same

image

the data is from indexed DB.

image

{
    "entries": [
        {
            "folderUri": "file:///test"
        },
        {
            "folderUri": "vscode-vfs://github/microsoft/vscode-docs",
            "label": "microsoft/vscode-docs [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a342c226964223a226d61676e69666963656e742d73696c6b776f726d227d7d/yiliang114/vscode",
            "label": "yiliang114/vscode (magnificent-silkworm) [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a342c226964223a226d61696e227d7d/microsoft/vscode",
            "label": "microsoft/vscode [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github/microsoft/vscode",
            "label": "microsoft/vscode [GitHub]"
        },
        {
            "workspace": {
                "id": "78103443",
                "configPath": "vsls:/Live%20Share.code-workspace?sessionId%3D328FE15D417678718A50F7B79FF3FA4AA1FC"
            }
        },
        {
            "folderUri": "vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a342c226964223a226d61696e227d7d/microsoft/vscode-docs",
            "label": "microsoft/vscode-docs [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a322c226964223a2264616466376137333737613461303430386333636661616333323130343961666537343761313738227d7d/microsoft/vscode",
            "label": "microsoft/vscode (dadf7a7) [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github/yiliang114/vscode",
            "label": "yiliang114/vscode [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github/yiliang114/vscode-pull-request-github",
            "label": "yiliang114/vscode-pull-request-github [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a342c226964223a226669782f6c6162656c2d6d617267696e227d7d/yiliang114/vscode-pull-request-github",
            "label": "yiliang114/vscode-pull-request-github (fix ∕ label-margin) [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a342c226964223a227061636b61676573227d7d/eclipse-theia/theia"
        },
        {
            "folderUri": "vscode-vfs://github/mircsoft/vscode"
        },
        {
            "folderUri": "vscode-vfs://github/eclipse-theia/theia",
            "label": "eclipse-theia/theia [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a342c226964223a226d6173746572227d7d/eclipse-theia/theia",
            "label": "eclipse-theia/theia [GitHub]"
        },
        {
            "folderUri": "vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a342c226964223a2230633066386337613761656464363739333062663635643666363364383237373231373037643630227d7d/eclipse-theia/theia",
            "label": "eclipse-theia/theia (0c0f8c7) [GitHub]"
        },
        {
            "fileUri": "vscode-vfs://github/microsoft/vscode-docs1/Untitled-1",
            "label": "microsoft/vscode-docs1/Untitled-1"
        }
    ]
}
yiliang114 commented 1 year ago
dadf7a7
"vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a342c226964223a226d61696e227d7d/microsoft/vscode"
// => https://vscode.dev/github/microsoft/vscode/tree/main

"vscode-vfs://github/microsoft/vscode"
// => https://vscode.dev/github/microsoft/vscode

One carries a branch and one does not carry a branch, cause the final uri to be inconsistent.

Can I deal with this problem? And I think the branch information can be displayed in label.

joyceerhl commented 1 year ago

We don't have a way to deduplicate the implicit and explicit URIs for a repo's main branch, can I ask how you ended up on https://vscode.dev/github/microsoft/vscode/tree/main? We should not be generating explicit URIs pointing to the default branch to start with

yiliang114 commented 1 year ago

We don't have a way to deduplicate the implicit and explicit URIs for a repo's main branch, can I ask how you ended up on https://vscode.dev/github/microsoft/vscode/tree/main? We should not be generating explicit URIs pointing to the default branch to start with

Through Copy vscode.dev link the saved folderUri contains branch information.

joyceerhl commented 1 year ago

Through Copy vscode.dev link the saved folderUri contains branch information.

Thank you, that is a bug.

yiliang114 commented 1 year ago

Through Copy vscode.dev link the saved folderUri contains branch information.

Thank you, that is a bug.

I feel that the problem is displayed by label, and the main branch is not revealed.

"vscode-vfs://github%2B7b2276223a312c22726566223a7b2274797065223a342c226964223a226d61696e227d7d/microsoft/vscode"
// label is "vscode (main) microsoft[github]"
"vscode-vfs://github/microsoft/vscode"
// label is "vscode   microsoft[github]"
joyceerhl commented 1 year ago

There's actually a deeper problem here

  1. Open https://vscode.dev/github/microsoft/vscode
  2. Make some changes
  3. Copy vscode.dev link to a file from the editor context menu
  4. Open that link
  5. Your changes from step 2 won't be there

This is because file deeplinks are blob urls and have a different vscode-vfs uri representation, so as far as VS Code is concerned they are actually different workspaces (and this has been the case from day 1, but now it happens more frequently because we generate HEAD links as well as permalinks).

Some approaches I could see us taking: