Manage functions in VS Code workspace

This page shows you how to manage multiple Cloud Functions configurations in a single workspace and a multi-folder workspace, and how to rearrange your Cloud Functions Explorer with Cloud Code.

Before you begin

This guide requires a workspace already setup (a launch.json file with at least one configuration listed). To get started with a sample, see the Create and deploy a function quickstart.

Manage multiple configurations in a single workspace

To add a new Cloud Function configuration to your launch.json file, follow these steps:

  1. Click Cloud Code and then expand the Cloud Functions Explorer.

  2. In the Cloud Functions Explorer, hold your pointer over WORKSPACE and click Add new cloud function configuration.

  3. Follow the prompts and perform the following actions:

    1. Enter a function name
    2. Select a Cloud Functions environment
    3. Enter an entry point (the name of the method to call for this function)
    4. Enter the test input

    Alternatively, you can manually enter these values into your launch.json file:

    {
        "configurations": [
          {
            "name": "Deploy Cloud Function",
            "type": "cloudcode.cloudfunctions",
            "request": "launch",
            "functionName": "Node.js: Hello World Get",
            "gen": "GEN_2",
            "entryPoint": "helloGet"
          }
        ]
    }
    

    Your Cloud Functions workspace corresponds to the first configuration listed in your launch.json file. The workspace name reflects the functionName of the first configuration listed in your launch.json file:

    {
        "configurations": [
          {
            "name": "Deploy Cloud Function",
            "type": "cloudcode.cloudfunctions",
            "request": "launch",
            "functionName": "Node.js: Hello World PubSub",
            "gen": "GEN_2",
            "entryPoint": "helloPubSub"
          },
          {
            "name": "Deploy Cloud Function",
            "type": "cloudcode.cloudfunctions",
            "request": "launch",
            "functionName": "Node.js: Hello World Get",
            "gen": "GEN_2",
            "entryPoint": "helloGet"
          }
        ]
    }
    
  4. (Optional) To deploy another configuration from your launch.json file, move the configuration you wish to deploy to the top of the launch.json file and click refresh Refresh Cloud Functions Explorer.

Manage a multi-folder workspace

Cloud Code supports having multiple folders in a Cloud Functions workspace if each function contains its own launch.json file.

Multi-folder workspace in Cloud Functions Explorer

Each Cloud Functions workspace folder that appears is named after the first configuration's functionName in its corresponding launch.json file.

To arrange a multi-folder workspace for your project, see VS Code's Multi-root Workspaces.

Rearrange Cloud Functions Explorer into your IDE's file Explorer

You can rearrange your Cloud Functions Explorer into VS Code's file Explorer by performing the following:

  1. Drag and drop your Cloud Functions Explorer into VS Code's file Explorer:

    Cloud Functions Explorer rearranged

    This arrangement displays your Cloud Functions Explorer under the file Explorer so that you can view your deployed functions and Cloud Functions workspace(s) in the same pane as your project files.

  2. (Optional) To undo this arrangement, right-click the Cloud Code: Cloud Functions Explorer's heading and select Reset location. This moves the Cloud Functions Explorer back to the Cloud Code tab.

Get Support

To send feedback, report issues on GitHub, or ask a question on Stack Overflow.