Open heaths opened 9 months ago
Hi 👋
This sounds cool, thanks for putting this up 💡
Quick clarifying question, as portsAttributes
apply to all the ports specified in forwardPorts
property. Is this something you are expecting? or do you prefer to only add path
property to certain/specific forwarded ports?
Quick clarifying question, as
portsAttributes
apply to all the ports specified inforwardPorts
property. Is this something you are expecting? or do you prefer to only addpath
property to certain/specific forwarded ports?
How do they apply to all ports when you're required to specify a port specification (single integer or string range) e.g.,
"portAttributes": {
"4000": {
"path": "/azure-sdk"
}
}
I certainly wouldn't want this to apply to all ports specified in the "forwardPorts": []
array.
Thanks for clarifying, your request makes sense to me. Along with the cli, spec and schema changes, I believe this will also require a change in VS Code, looping in @chrmarti for his insights.
/cc @alexr00 for the VS Code side.
Je sais pas comment faire
This seems reasonable to me!
This seems reasonable to me!
@alexr00 what would be the next steps? Is this something you'd like help with, if I can? I looked in the VSCode repo originally and didn't find any code that seemed to process portAttributes
- just the schemas or something. I may have time for working on this.
@samruddhikhandale @alexr00 Is this something Codespaces can adopt too? I remember the implementation there to be more involved than when the VS Code UI runs in a local window.
@samruddhikhandale @alexr00 Is this something Codespaces can adopt too? I remember the implementation there to be more involved than when the VS Code UI runs in a local window.
Looping in @osortega who can help answer this question.
The next steps:
remote.portsAttributes
VS Code setting. Code pointer: https://github.com/microsoft/vscode/blob/573a9ff995c4a63624eede783d6daa99da01c012/src/vs/workbench/services/remote/common/tunnelModel.ts#L192-L193@alexr00 Is this something Codespaces can adopt too? I remember the implementation there to be more involved than when the VS Code UI runs in a local window.
I would expect that there should be any additional work from Codespaces to make this happen. This would just be a property in the portsAttributes
setting, and I think we should be able handle everything else from within VS Code. I would need to check how things currently work in Codespaces in the browser, but so long as they already support navigating to a subdirectory it should be fine.
@heaths when would you expect the subdirectory to be applied?
onAutoForward
action in the portsAttributes
? (very doable)
- When the url opened from the Ports view? (very doable)
- When the url is opened from an onAutoForward action in the portsAttributes? (very doable)
Just those two. The link in the terminal window - at least as output from jekyll serve
- is already correct e.g., http://localhost:4000/azure-sdk
.
I'd be happy to submit PRs to respective repos, but it seems all those - including the one you linked to that I found previously - are just parsing/processing the config. Is the code that actually uses it and does all the forwarding / browser work elsewhere? Is that internal/private and would need to be done by you or someone on your team?
I don't think we actually need to make any changes to how the port is forwarded. If a process is listening at localhost:4000
on the remote machine and you want to access http://localhost:4000/azure-sdk
, then we should be able to just forward localhost:4000
locally to localhost:4000
then adding a path like /azure-sdk
should "just work".
The thing that we need to do is make sure to append the path (eg. /azure-sdk
) to the local URI in the correct places:
I would suggest adding a preferredPath
property here:
Updating the parsing somewhere here:
The merging of attributes here: https://github.com/microsoft/vscode/blob/68f565d32a8248b1c5677426621c34a875c1a8da/src/vs/workbench/services/remote/common/tunnelModel.ts#L964-L965
Then ensuring the preferredPath
gets applied correctly here:
here:
and here:
We would like a way to configure a path (subdirectory) of a site to open from a devcontainer. In VSCode, for example, clicking the
browse
button - or from the automatic prompt to open a browser when a port is forwarded - we could open a site likehttp://127.0.0.1:4000/azure-sdk
instead of onlyhttp://127.0.0.1:4000
. For GitHub Codespaces, this would be forwarded port to a remote continer.To
portAttributes
orotherPortAttributes
, this would add:path
http://127.0.0.1:4000/blog
on localhost.To the schema for both
portAttributes
orotherPortAttributes
1, this would look like:See microsoft/vscode-remote-release#9518 for additional context.
1 Since
portAttributes
andotherPortAttributes
appear to be the same schema, wouldn't a$ref
to a single object definition be sufficient and easier to maintain?