Closed jonathanpv closed 6 months ago
@connor4312 would like thoughts on this
here's my extension repo https://github.com/jonathanpv/codecontext
and the issue https://github.com/jonathanpv/codecontext/issues/1
I could be misusing the api though, so could just be my fault entirely
@jonathanpv some questions and thoughts:
remote.autoForwardPorts
and remote.autoForwardPortsSource
settings. Even if you're connect to a remote I don't think this should work as then the remote extension controls the tunnel provider.openTunnel
can also be used to cause VS Code to forward a port (which would eventually call your tunnel provider. @jonathanpv some questions and thoughts:
- Are you running your extension when connected to a remote (ex. using the Remote SSH extension)?
No I'm port forwarding only local ports and my code is nearly identical to
- It sounds like you're expecting that processes that listen on a port and are running in the same place as your extension get automatically picked up by VS Code and then forwarded using your tunnel provider. This will only happen if you're also connected to a remote. If you're connected to a remote, then this is controlled by the
remote.autoForwardPorts
andremote.autoForwardPortsSource
settings. Even if you're connect to a remote I don't think this should work as then the remote extension controls the tunnel provider.
Hmm unsure about the remote, but highlevel overview my extension is:
in extension.ts vscode insiders, copy the code from the local tunnel-forwarding
extension, copy the tunnelFactory classes/implementation
in extension.ts I locally start a server from the extension at port 6969
I'm able to successfully port forward 6969 as public and warn the user by calling provideTunnel()
from the classes I copied
i can then access the url by going through the extension output logs but i have to manually check the logs and add the port from the template URL which usually looks something like asdf123-{PORT}.devtunnels.com
i'd like to be able to copy the url from the ports tab and I believed the registerTunnelProvider
would've gotten me that
i have the repo with my example up and should be reproducible, but i can provide a video if need be to showcase the issue more clearly
- Also proposed API, which we don't have a plan to finalize: the
openTunnel
can also be used to cause VS Code to forward a port (which would eventually call your tunnel provider.
Hmm, I'll check openTunnel, I ended up using provideTunnel
from the example I saw from the built-in tunnel-forwarding
extension, let me check that one out
i can then access the url by going through the extension output logs but i have to manually check the logs and add the port from the template URL which usually looks something like asdf123-{PORT}.devtunnels.com
i'd like to be able to copy the url from the ports tab and I believed the registerTunnelProvider would've gotten me that
I think a screen recording would help me understand.
registerTunnelProvider
basically just powers the "Ports" view. It is not expected that extensions call provideTunnel
. That should only be called by VS Code.
So update, using openTunnel from the proposed 'tunnels' api does update the ports UI
Think I can simplify my code now to use that instead of tunnelFactory
tunnelFactory
is for extension that know how to forward ports and actually implement port forwarding.
openTunnel
is for extensions that know about a port that needs to be forwarded and want to cause it to be forwarded.
Does this issue occur when all extensions are disabled?: Yes/No
Steps to Reproduce:
I can also access it on the web since its public
however in the ports view i don't get to see the fact its been opened
is this because its still in preview? or doesn't work in dev mode?