Introduction

VSCode classifies itself as a code editor.  Thus, VSCode itself does not do the heavy lifting of compiling/linting/testing/etc.  Instead, it calls out to external command line utilities and language servers to do the bulk of the heavy lifting.  VSCode leverages the language server protocol which enables standardized communication with any language servers that support the protocol.  These design choices lead to VSCode being a powerful remote development environment but does require a higher-than-average initial setup time.

For developers wishing to utilize a remote Redhat/Ubuntu development environment, VSCode enables such an environment.  In a remote development setup, the Impala codebase resides on a remote Linux machine accessible via SSH.  The remote machine is where Impala is compiled, tested, and ran.  The VSCode backend server also runs on the remote machine.  A local machine is where the VSCode editor's front-end runs.  The protocol that VSCode uses for communication between its frontend and backend is very lightweight and thus provides a better experience versus other remote development solutions such as remote desktop access or network file sharing.

Setup

Prerequisites:  Successful completion of Bootstrapping an Impala Development Environment From Scratch.

To use VSCode for Impala development (either local or remote):

  1. Install VSCode.  If setting up a remote development environment, install VSCode on both the local and remote machines.
  2. If setting up a remote development environment, run VSCode on the local machine and connect it to the remote machine.
    1. Set up the remote development machine as a Host in the ~/.ssh/config file on the local machine.
    2. Install the Extension Remote-SSH (extension id: ms-vscode-remote.remote-ssh).
    3. Open the Command Palette and run the Remote-SSH: Connect to Host command.
    4. Select the SSH Host corresponding to the remote development machine (from step 2a).  A new VSCode window will open.
  3. Install the following Extensions.  When setting up a remote development environment, ensure it is being installed on the remote development environment by verifying the extension's install button has a title starting with "Install in SSH".
    1. C/C++ Extension Pack (extension id: ms-vscode.cpptools-extension-pack)
    2. Extension Pack for Java (extension id: vscjava.vscode-java-pack)
    3. Python (extension id: ms-python.python)
  4. Add the folders of each of the projects under development (e.g. "fe", "be", "shell", "tests", "bin").
  5. Follow the VSCode prompts to set up each project.

Using Dev Container (Developing Inside Docker Container)

  1. Install Visual Studio Code.
  2. Install Dev Containers extension.
  3. Open Visual Studio Code from $IMPALA_HOME, i.e. code $IMPALA_HOME
  4. Visual Studio will recognize .devcontainer configuration and will prompt to open in a container. Choose to open in a container. This process will take quite some time since it will need to run the bootstrap_development.sh.
  5. Visual Studio will install the necessary extensions needed for Impala development. When it prompts to install clangd, choose yes. That will provide code completion for C++.

For more information about Dev Container, refer to this doc.

  • No labels