Visual Studio Code In Browser



Coder.com has open sourced its cloud-server component which allows VSCode to run on a remote server fully accessible through the browser.

  1. There is way to choose the browser you would like to use. Here is the code snippet which will add different debug configuration to VS Code. To use this, first you need to open launch.json file. You can find the launch.json file under.vscode folder.
  2. The method of modifying tasks.json no longer works in newer versions of Visual Studio Code. The easiest way to be able to launch your code in a browser is to install the Open in Browser extension from the marketplace. After it is installed and VS Code is reloaded, you can go to your code and press ALT + B to launch your application in your default browser or ALT + SHIFT + B to select the browser you want to.
  3. It is a source-code editor while Visual Studio is an IDE (integrated development environment). VS Code supports development operations such as debugging, task running, and version control, like Visual Studio. In this blog, we will learn about developing, debugging, testing, and deploying ASP.NET Core applications using Visual Studio Code.

What is the advantage of that?

Available at Coder.com, its the alpha release of a completely virtualized hosted version of Visual Studio Code. Remotely develop from any browser equipped machine by simply navigating to ide.coder.com.

  • Code on your Chromebook, tablet, and laptop with a consistent dev environment.
  • Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
  • Preserve battery life when you're on the go as all intensive computation runs on your server, plus you're no longer running excess instances of Chrome.

Code-server is available as a single binary or Docker image and can be self hosted locally, which of course beats the purpose of portability, or on remote servers such as a VPSs' on Digital Ocean.
In addition to Digital Ocean's, there's also detailed instructions for Google Cloud and AWS.

Installation can be as easy as :

  1. Open a terminal on your computer and SSH into your instance
    example: ssh root@203.0.113.0
  2. Once in the SSH session, visit code-server releases page and copy the link to the download for the latest linux release
    Find the latest Linux release from this URL:
    https://github.com/codercom/code-server/releases/latest
  3. Replace {version} in the following command with the version found on the releases page and run it (or just copy the download URL from the releases page):
    wget https://github.com/codercom/code-server/releases/download/{version}/code-server-{version}-linux-x64.tar.gz
  4. Extract the downloaded tar.gz file with this command, for example:
    tar -xvzf code-server-{version}-linux-x64.tar.gz
  5. Navigate to extracted directory with this command:
    cd code-server-{version}-linux-x64
  6. If you run into any permission errors when attempting to run the binary:
    chmod +x code-server
  7. Finally start the code-server
    sudo ./code-server -p 80

Code-server is using a self-signed SSL certificate so that you can access it over HTTPS.For instructions on how to generate a self signed certificate and start code-server using your certificate/key, check Generate a self-signed certificate.

Now you can access VSCode when you visit your Droplets public IP on port 80, but of course you can bind it to another port if on 80 is already occupied.It might also worth protecting the end point with at least basic authentication or start code-server with the built-in option -P, --password <value> which requires a password for authentication.

Also an option to keep in mind is the --disable-telemetry flag or set DISABLE_TELEMETRY=true which disables the tracking Code.com does, collecting data for self improvement.It is not clear if that also disables the telemetry that Microsoft uses too.Recently we've seen the release of an other open source version of Visual Studio Code called VSCodium that doesn't pass telemetry data back to Microsoft aiming to offer a more private development experience to Visual Studio developers.

Studio

Code-server is available from Github, which repo is attracting a lot of popularity, 16,218 Stars and 863 forks at the time of writing.With that many forks, more customizable versions with extra features are bound to appear soon.Versions that for example enable code-server to integrate with the official VSCode Marketplace in order to use its
Extensions, something not currently supported out of the box.Code.com has however made a custom extension marketplace
focused around open-sourced extensions. That said if you have access to the .vsix file you can always manually install the extension.

More Information

Related Articles

To be informed about new articles on I Programmer, sign up for our weekly newsletter,subscribe to the RSS feed and follow us on Twitter,Facebook or Linkedin.

Git Command Explorer
22/04/2021

There's no shortage of ideas when it comes to making one's life easier when tackling Git. That says a lot about both the power and the learning curve of the tool. Here's a new educational tool th [ ... ]


Oracle V Google Android Case Settled
05/04/2021

At long last the 10 year case between Oracle and Google over the copyright or otherwise of the APIs used in Android is settled, the SCOTUS verdict is in.


More News


Comments


or email your comment to: comments@i-programmer.info

How To Run Visual Studio Code In Browser

A lightweight extension that allows you to browse and edit remote files over SFTP.

Features

  • Explorer-like view of any directory on a remote machine
  • Simple browsing interface separate from your current workspace.
  • Edit files locally and automatically sync them on save.
  • Supports multiple authentication modes.

Usage

  • set remoteBrowser.connectionOptions in User Settings
  • If passwordless auth is not available/not successful, you will be prompted for a password.

Extension Commands

  • Connect: Connect to remote machine.
  • Disconnect: Disconnect from remote machine.
  • Change Path: Change root path on the remote machine. Default root is the User's $HOME.

Extension Settings

  • remoteBrowser.connectionOptions: supports a subset of ssh2:ConnectConfig opts from the ssh2 library.
  • Example Config:
  • remoteBrowser.tmpFolder: Path to emporary folder for storing downloaded files

See the User Settings file for more info.

Notes

  • The extenstion relies on ssh2-sftp-client for remote connections.
  • Depending on your workflow, the extension is most effective when used along with an ssh client running in the terminal. Even better if you also use remote-vscode.

Roadmap

  • Tests
  • More Sort options.
  • Multiple server configurations.
  • Improved filtering.
  • More robust error handling

Contributing

Feel free to open an issue or drop a pull request!

Release Notes

0.7

  • Bottom status bar now displays file saving status.
  • Added a defaultPath option which specifies a default directory to cd into on initial connect.

0.6

  • Added support for multiple connections.
  • Fixed issue of password prompt being undismissable.
  • Fixed issue of files of the same name in different folders being considered the same.

0.5.6

  • Bug fixes. Thanks to @ronsano

0.5.5

  • Adds large file support. Thanks to @kimulimuli

0.5.3

  • Added a default sort - Folders first and alphabetical.
  • Added a filter option that allows filtering the current root folder by specifying a regex to test all filenames for. Might change this to a glob in the future.

0.5.2

  • Added context menu option - Make root (Use on any subdirectory to make it the new root for the explorer tree)
  • Fixed Bug where the '..'back option wasn't getting updated on root change.

0.5.1

  • Changed privateKey connection option to be a file path instead of an actual key string.
  • Fixed config file not being read after initialization.

0.5.0

Initial release