Hirse / vscode-ungit

Extension to show ungit in Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=Hirse.vscode-ungit
MIT License
28 stars 15 forks source link

Provide configurable urlBase. #92

Open wjziv opened 4 years ago

wjziv commented 4 years ago

This extension does not work when running VSCode through the browser via Code Server while hosted entirely on a separate server.

Expected (upon starting vscode-ungit):

Actual Results:

Proposed solution: Ungit provides a method for setting a urlBase other than localhost from the command line, shown in config.js.

If this can be set from .vscode/package.json and propagated throughout vscode-ungit to start/request visuals from Ungit on the correct machine, it may be all that's needed.

Figured I'd throw this out there in case the dev/someone who's closer to this project is able to approach it faster than I can as I acquaint myself with TS.

Below: Reference to the hardcoded localhost.

https://github.com/Hirse/vscode-ungit/blob/2b5d9cdbe56e3aa7831dad385308e4e93b34cbe3/src/extension.ts#L14

Hirse commented 4 years ago

Making the URL configurable itself is a rather simple change, but it would only work if your code-server is already running the ungit server.

Starting ungit on the remote machine instead of the local one requires some more information on how exactly code-server is running VSCode.

wjziv commented 4 years ago

There are a few different ways to set up code-server, but it may not be worthwhile to try to cover every single base out there. If, for example, somebody spun up a docker container without the foresight to include ungit at build, there's nothing this extension will be able to do about it.

I think allowing user-set parameters to point to an extant instance of ungit allows for accessibility in almost all special cases.

Mart10hub commented 4 years ago

I have the same issue when trying to use the extension with a SSH-Remote host, the hardcoded localhost points to the client machine instead of the host machine I can't say for CodeServer, but afaik, the extension runs on the remote Host, while the UI is on the client In this case, I think you can use workspaceFolder.uri.authority, which would give the ip address of the host where ungit is running, and provide it to the getWebViewHtml function I have absolutely no experience with vscode extensions and no time to do it myself, so I hope this helps

maxfi commented 3 years ago

In the case of ssh-remote you can simply port forward localhost:8448 and it will work. 🎉