Visual Studio Code

Set up Visual Studio Code to work seamlessly with CloudRepo for various programming languages.

Overview

Visual Studio Code is a lightweight, extensible editor that works well with CloudRepo through language-specific extensions and integrated terminal support.

Python Development

Configure VS Code for Python projects using CloudRepo repositories.

Setting Up pip

  1. Open VS Code settings (Cmd+, or Ctrl+,)

  2. Search for “python.terminal.activateEnvironment”

  3. Ensure it’s enabled for automatic venv activation

Configure pip.conf

Create or edit ~/.pip/pip.conf:

[global]
index-url = https://[org-id].cloudrepo.io/repository/pypi/simple
trusted-host = [org-id].cloudrepo.io

[install]
extra-index-url = https://pypi.org/simple

Using Environment Variables

Add to your .env file in the project root:

PIP_INDEX_URL=https://username:password@[org-id].cloudrepo.io/repository/pypi/simple
TWINE_REPOSITORY_URL=https://[org-id].cloudrepo.io/repository/pypi
TWINE_USERNAME=your-username
TWINE_PASSWORD=your-password

Poetry Integration

For Poetry projects, configure in pyproject.toml:

[[tool.poetry.source]]
name = "cloudrepo"
url = "https://[org-id].cloudrepo.io/repository/pypi/simple"
priority = "primary"

Java/Maven Development

VS Code supports Java through the Extension Pack for Java.

Install Extensions

  1. Install “Extension Pack for Java” from marketplace

  2. Install “Maven for Java” extension

  3. Restart VS Code

Configure Maven

The extension reads ~/.m2/settings.xml automatically. Ensure CloudRepo is configured:

<settings>
  <servers>
    <server>
      <id>cloudrepo</id>
      <username>your-username</username>
      <password>your-password</password>
    </server>
  </servers>
</settings>

Gradle Projects

For Gradle projects, VS Code reads build.gradle:

repositories {
    maven {
        url "https://[org-id].cloudrepo.io/repository/maven-releases"
        credentials {
            username = System.getenv("CLOUDREPO_USERNAME")
            password = System.getenv("CLOUDREPO_PASSWORD")
        }
    }
}

Terminal Integration

VS Code’s integrated terminal is perfect for CloudRepo operations.

Configure Shell Environment

Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):

# CloudRepo Configuration
export CLOUDREPO_ORG="your-org-id"
export CLOUDREPO_USERNAME="your-username"
export CLOUDREPO_PASSWORD="your-password"

# Aliases for common operations
alias cr-deploy-maven="mvn deploy -DrepositoryId=cloudrepo"
alias cr-upload-python="twine upload --repository cloudrepo"

Terminal Profiles

Configure custom terminal profiles in VS Code settings:

{
  "terminal.integrated.profiles.linux": {
    "CloudRepo Dev": {
      "path": "bash",
      "args": ["-l"],
      "env": {
        "CLOUDREPO_ENV": "development"
      }
    }
  }
}

Tasks Configuration

Automate CloudRepo operations with VS Code tasks.

Create .vscode/tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Deploy to CloudRepo (Maven)",
      "type": "shell",
      "command": "mvn deploy",
      "group": "build",
      "problemMatcher": ["$maven"]
    },
    {
      "label": "Upload to CloudRepo (Python)",
      "type": "shell",
      "command": "python setup.py sdist bdist_wheel && twine upload --repository cloudrepo dist/*",
      "group": "build",
      "problemMatcher": []
    },
    {
      "label": "Download from CloudRepo",
      "type": "shell",
      "command": "pip install ${input:packageName} --index-url https://${env:CLOUDREPO_ORG}.cloudrepo.io/repository/pypi/simple",
      "problemMatcher": []
    }
  ],
  "inputs": [
    {
      "id": "packageName",
      "type": "promptString",
      "description": "Package name to download"
    }
  ]
}

Launch Configurations

Debug applications with CloudRepo dependencies.

Python Debugging

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "env": {
        "PIP_INDEX_URL": "https://${env:CLOUDREPO_ORG}.cloudrepo.io/repository/pypi/simple"
      }
    }
  ]
}

Java Debugging

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "java",
      "name": "Launch Application",
      "request": "launch",
      "mainClass": "com.example.Application",
      "vmArgs": "-Dmaven.repo.remote=https://${env:CLOUDREPO_ORG}.cloudrepo.io/repository/maven-releases"
    }
  ]
}

Extensions for CloudRepo

Recommended extensions for CloudRepo development:

General

  • REST Client - Test CloudRepo APIs

  • Docker - Manage containers with CloudRepo images

  • GitLens - Enhanced Git integration

  • TODO Highlight - Track CloudRepo-related tasks

Python

  • Python - Core Python support

  • Pylance - Enhanced Python IntelliSense

  • Python Test Explorer - Run tests with CloudRepo dependencies

Java

  • Extension Pack for Java - Complete Java support

  • Maven for Java - Maven integration

  • Gradle for Java - Gradle support

Workspace Settings

Configure CloudRepo settings per workspace.

.vscode/settings.json

{
  "python.defaultInterpreterPath": "./venv/bin/python",
  "python.terminal.activateEnvironment": true,
  "python.linting.enabled": true,
  "java.configuration.maven.userSettings": "${workspaceFolder}/.mvn/settings.xml",
  "terminal.integrated.env.linux": {
    "CLOUDREPO_ORG": "your-org-id"
  },
  "files.exclude": {
    "**/dist": true,
    "**/build": true,
    "**/__pycache__": true
  }
}

Security Best Practices

Protecting Credentials

  1. Never commit credentials to version control

  2. Use .env files and add to .gitignore:

# .gitignore
.env
.env.local
settings.xml
.pypirc
  1. Use VS Code’s Secret Storage API in extensions

  2. Configure keyring for Python:

pip install keyring
keyring set https://[org-id].cloudrepo.io username

Snippets for CloudRepo

Create custom snippets for common CloudRepo configurations.

Python Snippets

Add to .vscode/python.code-snippets:

{
  "CloudRepo Upload": {
    "prefix": "cloudrepo-upload",
    "body": [
      "import subprocess",
      "subprocess.run(['twine', 'upload', '--repository', 'cloudrepo', 'dist/*'])"
    ]
  }
}

Maven Snippets

Add to .vscode/xml.code-snippets:

{
  "CloudRepo Repository": {
    "prefix": "cloudrepo-repo",
    "body": [
      "<repository>",
      "  <id>cloudrepo</id>",
      "  <url>https://${1:org-id}.cloudrepo.io/repository/${2:maven-releases}</url>",
      "</repository>"
    ]
  }
}

Troubleshooting

Common Issues

Python packages not found:
  • Check pip index URL configuration

  • Verify virtual environment is activated

  • Clear pip cache: pip cache purge

Maven dependencies not resolving:
  • Refresh Maven project

  • Check settings.xml location

  • Verify credentials

Authentication failures:
  • Check environment variables

  • Verify credentials in keyring

  • Ensure proper URL encoding for special characters

Tips and Tricks

  1. Use Multi-root Workspaces for projects with different CloudRepo repositories

  2. Configure File Watchers to auto-upload on changes

  3. Set Up Remote Development to access CloudRepo from anywhere

  4. Use Live Share for collaborative CloudRepo development

  5. Enable Settings Sync to share CloudRepo configuration across machines

Additional Resources