|
| 1 | +# VS Code Setup for SceneScape |
| 2 | + |
| 3 | +This guide configures Visual Studio Code for optimal SceneScape development with cross-module navigation and IntelliSense. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Ubuntu 24.04 LTS |
| 8 | +- Python 3.12 |
| 9 | +- Git |
| 10 | +- Visual Studio Code |
| 11 | + |
| 12 | +### Initial Setup |
| 13 | + |
| 14 | +Before configuring VS Code, set up the project environment: |
| 15 | + |
| 16 | +1. **Clone the repository** |
| 17 | + |
| 18 | + ```bash |
| 19 | + git clone https://github.com/open-edge-platform/scenescape.git |
| 20 | + cd scenescape |
| 21 | + ``` |
| 22 | + |
| 23 | +2. **Create and activate virtual environment** |
| 24 | + |
| 25 | + ```bash |
| 26 | + python3.12 -m venv .venv |
| 27 | + source .venv/bin/activate |
| 28 | + ``` |
| 29 | + |
| 30 | +3. **Install Python dependencies** |
| 31 | + |
| 32 | + ```bash |
| 33 | + pip install --upgrade pip |
| 34 | + pip install -r controller/requirements-runtime.txt |
| 35 | + pip install -r manager/requirements-runtime.txt |
| 36 | + pip install -r autocalibration/requirements-runtime.txt |
| 37 | + pip install -r model_installer/requirements-runtime.txt |
| 38 | + |
| 39 | + # Optional: Install test requirements |
| 40 | + pip install -r manager/test/requirements-test.txt |
| 41 | + ``` |
| 42 | + |
| 43 | +4. **Build project components** |
| 44 | + ```bash |
| 45 | + make |
| 46 | + ``` |
| 47 | + |
| 48 | +## Quick Setup |
| 49 | + |
| 50 | +Assuming you have the SceneScape project cloned and Python environment ready: |
| 51 | + |
| 52 | +1. Open VS Code |
| 53 | +2. Use **File → Open Folder** and select the `scenescape` directory |
| 54 | +3. VS Code will load the workspace with the project structure |
| 55 | + |
| 56 | +## Required Extensions |
| 57 | + |
| 58 | +Install these essential VS Code extensions for Python development: |
| 59 | + |
| 60 | +### Python Extension Pack |
| 61 | + |
| 62 | +- **[Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)** (Microsoft) |
| 63 | + - Core Python language support |
| 64 | + - Debugging, linting, and code formatting |
| 65 | + - Extension ID: `ms-python.python` |
| 66 | + |
| 67 | +- **[Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance)** (Microsoft) |
| 68 | + - Fast Python language server |
| 69 | + - Type checking and IntelliSense |
| 70 | + - Auto-imports and code navigation |
| 71 | + - Extension ID: `ms-python.vscode-pylance` |
| 72 | + |
| 73 | +### Installation Steps |
| 74 | + |
| 75 | +1. Open Extensions view (`Ctrl+Shift+X`) |
| 76 | +2. Search for "Python" and install the **Microsoft** Python extension |
| 77 | +3. Search for "Pylance" and install the **Microsoft** Pylance extension |
| 78 | + |
| 79 | +> **Tip:** You can also copy and paste the extension IDs directly into the search box: |
| 80 | +> |
| 81 | +> - `ms-python.python` |
| 82 | +> - `ms-python.vscode-pylance` |
| 83 | +
|
| 84 | +## Workspace Configuration |
| 85 | + |
| 86 | +Create `.vscode/settings.json` in the project root, or press `Ctrl+Shift+P` → "Preferences: Open Workspace Settings (JSON)" |
| 87 | + |
| 88 | +```json |
| 89 | +{ |
| 90 | + "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", |
| 91 | + "python.terminal.activateEnvironment": true, |
| 92 | + "python.analysis.extraPaths": [ |
| 93 | + "${workspaceFolder}", |
| 94 | + "${workspaceFolder}/manager/src/django", |
| 95 | + "${workspaceFolder}/tests", |
| 96 | + "${workspaceFolder}/scene_common/src", |
| 97 | + "${workspaceFolder}/controller/src", |
| 98 | + "${workspaceFolder}/autocalibration/src", |
| 99 | + "${workspaceFolder}/manager/src" |
| 100 | + ], |
| 101 | + "python.analysis.autoImportCompletions": true, |
| 102 | + "python.analysis.autoSearchPaths": true |
| 103 | +} |
| 104 | +``` |
| 105 | + |
| 106 | +## What This Configuration Enables |
| 107 | + |
| 108 | +- **Automatic Python Environment**: Uses `.venv/bin/python` automatically |
| 109 | +- **Cross-Module Navigation**: Jump between modules with F12 (Go to Definition) |
| 110 | +- **IntelliSense**: Auto-completion across all project components |
| 111 | +- **Import Resolution**: Finds imports in `scene_common`, `controller`, `manager`, `autocalibration`, and `tests` |
| 112 | + |
| 113 | +## Verify Setup |
| 114 | + |
| 115 | +1. Open any Python file in `scene_common/src/` or `controller/src/` |
| 116 | +2. Check that VS Code status bar shows Python interpreter from `.venv` |
| 117 | +3. Verify that imports and IntelliSense work across modules |
| 118 | +4. Test cross-module navigation: |
| 119 | + - Right-click on any import from `scene_common` → "Go to Definition" (F12) |
| 120 | + - Use "Find All References" (Shift+F12) on functions/classes |
| 121 | + - Verify autocomplete works for imports from other modules |
| 122 | + |
| 123 | +## Troubleshooting |
| 124 | + |
| 125 | +- If Python interpreter is not detected, press `Ctrl+Shift+P` → "Python: Select Interpreter" → Choose `.venv/bin/python` |
| 126 | +- If imports are not resolved, restart VS Code or reload the window (`Ctrl+Shift+P` → "Developer: Reload Window") |
0 commit comments