|
1 | | -# Contributing to the Jupyter extension for Visual Studio Code |
| 1 | +# Contributing to the Deepnote Extension for Visual Studio Code |
2 | 2 |
|
3 | | ---- |
4 | | - |
5 | | -| `main` branch | |
6 | | -| ------------- | |
7 | | - |
8 | | -## |  |
9 | | - |
10 | | -[For contributing to the [Microsoft Python Language Server](https://github.com/Microsoft/python-language-server) see its own repo; for [Pylance](https://github.com/microsoft/pylance-release) see its own repo; for [debugpy](https://github.com/microsoft/debugpy) see its own repo] |
| 3 | +Thank you for your interest in contributing to the Deepnote VS Code extension! This guide will help you set up your development environment and understand the contribution workflow. |
11 | 4 |
|
12 | 5 | ## Contributing a pull request |
13 | 6 |
|
|
24 | 17 | - [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) |
25 | 18 | - [Python Extension for VS Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python) |
26 | 19 |
|
| 20 | +<details> |
| 21 | +<summary><b>📦Or use these commands to install the prerequisites</b></summary> |
| 22 | + |
| 23 | +#### macOS (using Homebrew) |
| 24 | +```bash |
| 25 | +# Install Node.js |
| 26 | +brew install node@22 |
| 27 | + |
| 28 | +# Install Python |
| 29 | +brew install python3 |
| 30 | + |
| 31 | +# Install VS Code |
| 32 | +brew install --cask visual-studio-code |
| 33 | + |
| 34 | +# Install VS Code extensions |
| 35 | +code --install-extension dbaeumer.vscode-eslint |
| 36 | +code --install-extension esbenp.prettier-vscode |
| 37 | +code --install-extension EditorConfig.EditorConfig |
| 38 | +code --install-extension ms-python.python |
| 39 | +``` |
| 40 | + |
| 41 | +#### macOS/Linux (using nvm for Node.js) |
| 42 | +```bash |
| 43 | +# Install nvm (if not already installed) |
| 44 | +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash |
| 45 | + |
| 46 | +# Install Node.js |
| 47 | +nvm install 22.15.1 |
| 48 | +nvm use 22.15.1 |
| 49 | + |
| 50 | +# Update npm |
| 51 | + |
| 52 | + |
| 53 | +# Install Python (Ubuntu/Debian) |
| 54 | +sudo apt update && sudo apt install python3 python3-pip python3-venv |
| 55 | + |
| 56 | +# Install Python (Fedora) |
| 57 | +sudo dnf install python3 python3-pip |
| 58 | + |
| 59 | +# Install VS Code (Ubuntu/Debian) |
| 60 | +sudo snap install code --classic |
| 61 | + |
| 62 | +# Install VS Code extensions |
| 63 | +code --install-extension dbaeumer.vscode-eslint |
| 64 | +code --install-extension esbenp.prettier-vscode |
| 65 | +code --install-extension EditorConfig.EditorConfig |
| 66 | +code --install-extension ms-python.python |
| 67 | +``` |
| 68 | +</details> |
| 69 | + |
27 | 70 | ### Setup |
28 | 71 |
|
29 | 72 | ```shell |
30 | | -git clone https://github.com/microsoft/vscode-jupyter |
31 | | -cd vscode-jupyter |
32 | | - |
| 73 | +git clone https://github.com/deepnote/vscode-deepnote |
| 74 | +cd vscode-deepnote |
33 | 75 | ``` |
34 | 76 |
|
35 | 77 | #### Install Recommended Extensions |
@@ -117,6 +159,81 @@ npm run watch-all |
117 | 159 | Sometimes you will need to run `npm run clean` and even `rm -r out dist`. |
118 | 160 | This is especially true if you have added or removed files. |
119 | 161 |
|
| 162 | +### Running the Extension |
| 163 | + |
| 164 | +After completing the setup steps, you can run the Deepnote extension in development mode: |
| 165 | + |
| 166 | +#### Quick Start |
| 167 | + |
| 168 | +1. **Open the project in VS Code** |
| 169 | + ```bash |
| 170 | + code . |
| 171 | + ``` |
| 172 | + |
| 173 | +2. **Start the watch task** (for automatic recompilation) |
| 174 | + - Press `Ctrl+Shift+B` (Windows/Linux) or `⇧⌘B` (macOS) |
| 175 | + - Select `watch` from the task list |
| 176 | + - This will continuously compile your changes in the background |
| 177 | + |
| 178 | +3. **Launch the Extension Development Host** |
| 179 | + - Press `F5` or click the Run and Debug icon in the sidebar |
| 180 | + - Select `Extension` from the dropdown menu |
| 181 | + - Click the green play button |
| 182 | + - A new VS Code window will open with `[Extension Development Host]` in the title |
| 183 | + |
| 184 | +4. **Test your changes** |
| 185 | + - The Extension Development Host has the Deepnote extension loaded |
| 186 | + - Open a Deepnote project or notebook file (`.deepnote`) |
| 187 | + - Test the functionality you're working on |
| 188 | + - Check the Debug Console in your main VS Code window for logs |
| 189 | + |
| 190 | +5. **Reload after making changes** |
| 191 | + - The watch task automatically recompiles when you save files |
| 192 | + - In the Extension Development Host window, press `Ctrl+R` (Windows/Linux) or `Cmd+R` (macOS) to reload |
| 193 | + - Or restart the debug session with `Ctrl+Shift+F5` / `Cmd+Shift+F5` |
| 194 | + |
| 195 | +#### Available Debug Configurations |
| 196 | + |
| 197 | +The project includes several launch configurations in `.vscode/launch.json`: |
| 198 | + |
| 199 | +- **Extension** - Run the extension in a new VS Code window (most common for development) |
| 200 | +- **Extension (web)** - Test the web version of the extension |
| 201 | +- **Extension inside container** - Test in a containerized environment |
| 202 | +- **Unit Tests** - Run unit tests without VS Code |
| 203 | +- **Tests (Jupyter+Python Extension installed)** - Run integration tests |
| 204 | + |
| 205 | +#### Debugging Tips |
| 206 | + |
| 207 | +<details> |
| 208 | +<summary>Click to expand debugging tips</summary> |
| 209 | + |
| 210 | +**Enable detailed logging:** |
| 211 | +Edit `.vscode/launch.json` and add environment variables: |
| 212 | +```json |
| 213 | +"env": { |
| 214 | + "VSC_JUPYTER_FORCE_LOGGING": "1", |
| 215 | + "VSC_JUPYTER_LOG_TELEMETRY": "1", |
| 216 | + "VSC_JUPYTER_LOG_IPYWIDGETS": "1" |
| 217 | +} |
| 218 | +``` |
| 219 | + |
| 220 | +**Set breakpoints:** |
| 221 | +- Click in the gutter next to line numbers in your TypeScript code |
| 222 | +- Breakpoints will pause execution in the Extension Development Host |
| 223 | +- Inspect variables in the Debug sidebar |
| 224 | + |
| 225 | +**View logs:** |
| 226 | +- Debug Console: Shows console.log output and errors |
| 227 | +- Output panel: Select "Deepnote" from the dropdown to see extension-specific logs |
| 228 | +- Terminal: Shows build output from the watch task |
| 229 | + |
| 230 | +**Common issues:** |
| 231 | +- If changes don't appear, try `npm run clean` and restart the watch task |
| 232 | +- If breakpoints don't work, ensure source maps are enabled (they are by default) |
| 233 | +- If the extension doesn't load, check the Debug Console for errors |
| 234 | + |
| 235 | +</details> |
| 236 | + |
120 | 237 | ### Errors and Warnings |
121 | 238 |
|
122 | 239 | TypeScript errors and warnings will be displayed in the `Problems` window of Visual Studio Code. |
|
0 commit comments