Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Cyclenerd/google-cloud-shell-vscode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run OpenVSCode Server in Google Cloud Shell

Bagde: Google Cloud Bagde: Visual Studio Code


Update: December 2023

You can now use Open VS Code (Code OSS) without extra installation as Google Cloud Shell Editor. Theia is currently still available as a legacy editor.

Screenshot: Code OSS

An extra installation and this project are therefore no longer necessary.


Install and start OpenVSCode Server in Google Cloud Shell.

Google Cloud Shell is available at no additional cost (free) for Google Cloud customers and you get 5 GB of persistent storage.

1. Open

Start Google Cloud Shell:

Open in Cloud Shell

2. Download

Download code.sh script:

curl -O "https://raw.githubusercontent.com/Cyclenerd/google-cloud-shell-vscode/master/code.sh"

3. Install

Install latest OpenVSCode Server:

bash code.sh install

4. Start

Start OpenVSCode Server:

bash code.sh

Open web preview URL:

Screenshot: Open web preview

Settings

Your user settings are stored in the browser's local cache. If you use another browser and if the preview URL changes, your settings are gone. Unfortunately, the preview URL changes over time. It is therefore strongly recommended to make the settings in the remote area.

Open Settings (Ctrl + ,) and click on Remote...: Screenshot: OpenVSCode Settings

Open Settings JSON: Screenshot: OpenVSCode Settings

My settings:

{
    "editor.minimap.enabled": false,
    "editor.renderWhitespace": "all",
    "editor.renderControlCharacters": true,
    "editor.fontSize": 14,
    "editor.fontFamily": "'Source Code Pro Medium', 'Source Code Pro', Monaco, 'Courier New', monospace",
    "workbench.colorTheme": "Dracula",
    "editor.acceptSuggestionOnEnter": "smart",
    "workbench.startupEditor": "newUntitledFile",
    "files.eol": "\n",
    "git.enableSmartCommit": true,
    "terminal.integrated.defaultProfile.linux": "tmux",
    "extensions.ignoreRecommendations": true,
    "git.ignoreMissingGitWarning": true,
    "workbench.editor.enablePreview": false,
    "problems.decorations.enabled": false,
    "html.autoClosingTags": false,
    "diffEditor.ignoreTrimWhitespace": false
}

The remote OpenVSCode Server settings are located in the remote file system in the Cloud Shell under:

jq < $HOME/.openvscode-server/data/Machine/settings.json

Tip

Add code.sh to your Bash aliases with absolute pathnames. You can then execute code anywhere.

Alias (~/.bash_aliases):

echo "alias code='bash `pwd`/code.sh'" >> ~/.bash_aliases && bash

Usage

Help:

bash code.sh help
Usage: code.sh [COMMAND]
COMMAND is one of the following:
        install - install latest OpenVSCode Server
        upgrade - alias for install
        start   - start OpenVSCode Server (127.0.0.1:8080)
        remove  - remove OpenVSCode Server
        help    - displays help (this message)

Why

Why..? You may ask..: "For me, the standard looks exactly the same, doesn't it?"

Screenshot: Theia vs. VS Code

The default editor is Theia, and it's definitely an excellent product.

GitPod writes about this topic in their blog:

To convince developers to say goodbye to local development, it is important to not reinvent the wheel but offer an editing experience that:

  • Is backed by a thriving community
  • Wins hearts and minds of developers
  • Works on modern web technology

This is VS Code.

My developer heart is set on VS Code 🧑‍💻💘. I don't want to miss the marketplace and the VS Code extensions. I also like the 160px more vertical space for the source code.

If you feel the same way, this project with the script will help you. If you get along with Theia, also good. This is diversity.

If you rely on Cloud Code, please support this issue. Google unfortunately does not publish to the vendor neutral, Open Source marketplace for VS Code Open VSX.

Contributing

Have a patch that will benefit this project? Awesome! Follow these steps to have it accepted.

  1. Please read how to contribute.
  2. Fork this Git repository and make your changes.
  3. Create a Pull Request.
  4. Incorporate review feedback to your changes.
  5. Accepted!

License

All files in this repository are under the Apache License, Version 2.0 unless noted otherwise.