terminal
terminal copied to clipboard
Add support for Azure Cloud Shell `code` Editor
Environment
Windows build number: Windows 10 Version 1909 Build 18363.657
Windows Terminal version: 0.11.1121.0
Steps to reproduce
- Open the Windows Terminal
- Open Azure Cloud Shell
- Login to Azure
- Type code . or code file.txt
Expected behavior
The azure cloud shell editor should open in the background with the provided file like explained here: https://docs.microsoft.com/en-us/azure/cloud-shell/using-cloud-shell-editor.
Actual behavior
Nothing happens no editor will be opened.
Huh, there was another thread on this repo months ago about this but the user never actually provided any more info about what code .
was supposed to do. TIL about the code
thing, thanks, that's pretty cool actually!
I'm very curious how that actually works in the browser. It's certainly easy enough for them to embed a JS text editor somewhere in the html of the webpage, but that would be a little trickier for us.
I'll tag this up as a potential extension idea in the future, since this correlates strongly with a lot of the work we're doing there.
Hi,
thanks for the quick reply. Is it also possible as a workaround to use visual studio code within the azure cloud shell and launch the file in windows visual studio code like with the ubuntu wsl?
Unfortunately, this might be something we just can't do. It only works on the web because Code can be embedded in the webapp. Hmm.
Could you include an error message explaining that the feature isn't available? Right now if you run code
in Az Cloud Shell it just fails silently. Not sure if that would be a WT issue or an AzCS issue. As another commenter suggested, reditrecting/referring to VSCode seems like a good work-around
Could you include an error message explaining that the feature isn't available
I'm not sure that's something we could control. That'd have to be a feature of the Cloud Shell itself I'm afraid.
Are Code Tunnels an option here?
On an Ubuntu VM I can run the following:
wget https://code.visualstudio.com/sha/download?build=stable\&os=cli-alpine-x64 -O /tmp/code.tar.gz
sudo tar -zxvf /tmp/code.tar.gz -C /usr/local/bin && rm /tmp/code.tar.gz
code tunnel --name $(hostname) --accept-server-license-terms
And awesome things happen. (Code Tunnels are so good.)
I tried the following on Cloud Shell in Windows Terminal:
wget https://code.visualstudio.com/sha/download?build=stable\&os=cli-alpine-x64 -O /tmp/code.tar.gz
[[ ! -d ~/.local/bin ]] && mkdir -pm 755 ~/.local/bin
tar -zxvf /tmp/code.tar.gz -C ~/.local/bin && rm /tmp/code.tar.gz
mv ~/.local/bin/code ~/.local/bin/vscode
vscode tunnel --name $(hostname | cut -c1-20) --accept-server-license-terms --no-sleep
And it does the OAuth part, but then gets stuck in an API storm of some type, looping with this error: "This application has made an unusually high number of requests to access your account. Please reauthorize the application to continue."