Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode.dev Cannot open a file in a folder #187826

Closed
yiliang114 opened this issue Jul 13, 2023 · 13 comments · Fixed by #188166
Closed

vscode.dev Cannot open a file in a folder #187826

yiliang114 opened this issue Jul 13, 2023 · 13 comments · Fixed by #188166
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@yiliang114
Copy link
Contributor

ADD ISSUE DESCRIPTION HERE

Version: 1.80.0
Commit: 660393d
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Embedder: vscode.dev

I got a link to a file through the local vscode

image

Reproduction steps:

  1. Use the local vscode to open any project,
  2. Right-click the file, select Share, and select Copy vscode.dev link
  3. Paste it into browser to open vscode.dev
  4. After the vscode is loaded, the file path carried by the url will be lost and cannot be recognized.
  5. The same problem on insider.vscode.dev

bug6

@yiliang114
Copy link
Contributor Author

This problem is more common when sharing a file with others. Or is there any other good way?

@joyceerhl
Copy link
Contributor

What is the result of git remote -v for you? I'm guessing you have two remotes, we're probably picking the wrong one when constructing the link

@joyceerhl joyceerhl added the bug Issue identified by VS Code Team member as probable bug label Jul 14, 2023
@joyceerhl joyceerhl added this to the July 2023 milestone Jul 14, 2023
@yiliang114
Copy link
Contributor Author

hi @joyceerhl I do have two remotes, but in fact, the link I copied carries the name of the source project group. just like

image

And here is my remotes
image

@joyceerhl
Copy link
Contributor

Thanks for confirming!

@joyceerhl
Copy link
Contributor

@yiliang114 I cannot repro the behavior you describe. This is what I tried:

  1. Have two remotes, origin is https://github.com/microsoft/vscode.git and joyceerhl is https://github.com/joyceerhl/vscode
  2. Create a feature branch that is published to joyceerhl
  3. Copy vscode.dev link from the editor gutter context menu
  4. The link that is copied is for the joyceerhl remote

This is the relevant code which picks the remote that your branch was published to: https://github.com/joyceerhl/vscode/blob/5653420433692dc4269ad39adbc143e3438af179/extensions/github/src/links.ts#L152-L153

Can you please share your setup steps if they are different from the above steps? Thanks!

@joyceerhl joyceerhl added the info-needed Issue requires more information from poster label Jul 16, 2023
@yiliang114
Copy link
Contributor Author

@joyceerhl
Sorry, my previous description may not be clear enough. Is our difference due to the default remote branch?

image

My previous operation was to clone the source of Microsoft first:

  1. git clone https://github.com/microsoft/vscode.git
  2. then git remote add https://github.com/yiliang114/vscode.git

@yiliang114
Copy link
Contributor Author

@joyceerhl
Copy link
Contributor

In the linked code AFAICT we would still loop over all the remotes, favoring a perfect match for the branch's upstream and falling back to one of the remotes if any are available. We don't match on just the first remote because the predicate we pass to Array.prototype.find always returns undefined.

I tried matching your setup and copying links still works as expected for me:
image

Does this happen for you on all branches or just the magnificent-silkworm branch? Can I double check that you are using the Copy vscode.dev Link context menu command from the editor gutter (right clicking on the editor line number)?

@yiliang114
Copy link
Contributor Author

In the linked code AFAICT we would still loop over all the remotes, favoring a perfect match for the branch's upstream and falling back to one of the remotes if any are available. We don't match on just the first remote because the predicate we pass to Array.prototype.find always returns undefined.

I tried matching your setup and copying links still works as expected for me: image

Does this happen for you on all branches or just the magnificent-silkworm branch? Can I double check that you are using the Copy vscode.dev Link context menu command from the editor gutter (right clicking on the editor line number)?

It makes me a little confused. For me, the same is true for other branches, it will find Microsoft's remote instead of my own remote.

bug8

Before pushing the new branch, this is the effect. After pushing the new branch to my remote, the link copied from the right-click menu is also Microsoft's remote.

bug9

@yiliang114
Copy link
Contributor Author

In the linked code AFAICT we would still loop over all the remotes, favoring a perfect match for the branch's upstream and falling back to one of the remotes if any are available. We don't match on just the first remote because the predicate we pass to Array.prototype.find always returns undefined.
I tried matching your setup and copying links still works as expected for me: image
Does this happen for you on all branches or just the magnificent-silkworm branch? Can I double check that you are using the Copy vscode.dev Link context menu command from the editor gutter (right clicking on the editor line number)?

It makes me a little confused. For me, the same is true for other branches, it will find Microsoft's remote instead of my own remote.

bug8

Before pushing the new branch, this is the effect. After pushing the new branch to my remote, the link copied from the right-click menu is also Microsoft's remote.

bug9

hi @joyceerhl I'm sorry, I found that the difference between me and you may be caused by my failure to update the latest version of vscode...

I updated the latest version after 1.80.1 (Universal) , Now the interaction becomes, after right-clicking the file or code and selecting Copy vscode.dev link, a confirmation box fallback will appear, but a new problem has arisen.

I have manually pushed the code to the remote, but the confirmation box still appears (at this time one of the remote branches already exists)

image

image

Looks like vscode doesn't know that I 've just pushed the branch to one of the remotes

But anyway after I select Publish Branch & Copy link, after clicking on a remote in the quickPick List, the copied link is already correct.

@joyceerhl
Copy link
Contributor

Thanks for all the info, I have a PR out to fix this issue

Looks like vscode doesn't know that I 've just pushed the branch to one of the remotes

If you can, please try out the fix in tomorrow's Insiders build: https://code.visualstudio.com/insiders

@VSCodeTriageBot VSCodeTriageBot added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jul 18, 2023
@sandy081 sandy081 added the verification-steps-needed Steps to verify are needed for verification label Jul 26, 2023
@sandy081
Copy link
Member

@joyceerhl Does the steps in description are up to date to verify or has any other specific steps?

@joyceerhl
Copy link
Contributor

  1. Have a desktop git repo open with two remotes
  2. From the terminal, create and push a branch to one of the remotes
  3. Copy a link from the editor gutter
  4. Ensure the link is valid

@joyceerhl joyceerhl removed the info-needed Issue requires more information from poster label Jul 26, 2023
@joyceerhl joyceerhl removed the verification-steps-needed Steps to verify are needed for verification label Jul 26, 2023
@roblourens roblourens added the verified Verification succeeded label Jul 26, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants