Editor Setup
Your editor is your co-pilot. Configure it once so it stays out of your way and starts pulling its weight.
Lesson 8 of 13Build~20 minutes--
Before this: Lesson 1 of Phase 0
On this page
Learning Objectives
- Install VS Code with essential extensions for Python, Jupyter, linting, and remote SSH
- Configure format-on-save, type checking, and notebook output scrolling for AI workflows
- Set up Remote SSH to edit and debug code on remote GPU machines as if they were local
- Evaluate editor alternatives (Cursor, Windsurf, Neovim) and their tradeoffs for AI work
The Problem
You'll spend thousands of hours inside your editor writing Python, running notebooks, debugging training loops, and SSH-ing into GPU boxes. A misconfigured editor turns every session into friction: no autocomplete, no type hints, no inline errors, manual formatting, and a clunky terminal workflow.
The right setup takes 20 minutes. Skipping it costs you 20 minutes every day.
The Concept
An AI engineering editor setup needs five things:
s0-lsp-roundtrip
Build It
Step 1: Install VS Code
VS Code is the recommended editor. It is free, runs on every OS, has first-class Jupyter notebook support, and the extension ecosystem covers everything you need for AI work.
Download it from code.visualstudio.com.
Verify from the terminal:
code --version
If code is not found on macOS, open VS Code, press Cmd+Shift+P, type "Shell Command", and select "Install 'code' command in PATH".
Step 2: Install Essential Extensions
Open the integrated terminal in VS Code (Ctrl+` on every platform) and install the extensions that matter for AI work:
code --install-extension ms-python.python
code --install-extension ms-python.vscode-pylance
code --install-extension ms-toolsai.jupyter
code --install-extension eamodio.gitlens
code --install-extension ms-vscode-remote.remote-ssh
code --install-extension ms-python.debugpy
code --install-extension ms-python.black-formatter
code --install-extension charliermarsh.ruff
What each one does:
| Extension | Why |
|---|---|
| Python | Language support, virtual env detection, run/debug |
| Pylance | Fast type checking, autocomplete, import resolution |
| Jupyter | Run notebooks inside VS Code, variable explorer |
| GitLens | See who changed what, inline git blame |
| Remote SSH | Open a folder on a remote GPU box as if it were local |
| Debugpy | Step-through debugging for Python |
| Black Formatter | Auto-format on save, consistent style |
| Ruff | Fast linting, catches common mistakes |
The file code/vscode/extensions.json in this lesson contains the full recommendations list. Copy it to .vscode/extensions.json in your project folder, and VS Code prompts you to install them when you open that folder.
Step 3: Configure Settings
Copy the settings from code/vscode/settings.json in this lesson, or apply them manually through Settings > Open Settings (JSON).
The key settings for AI work:
{
"python.analysis.typeCheckingMode": "basic",
"editor.formatOnSave": true,
"editor.rulers": [88, 120],
"notebook.output.scrolling": true,
"files.autoSave": "afterDelay"
}
Why these matter:
- Type checking on basic: Catches wrong argument types before you run. Saves debugging time on tensor shape mismatches and wrong API parameters.
- Format on save: Never think about formatting again. Black handles it.
- Rulers at 88 and 120: Black wraps at 88. The 120 marker shows when docstrings and comments are getting too long.
- Notebook output scrolling: Training loops print thousands of lines. Without scrolling, the output panel explodes.
- Auto-save: You will forget to save. Your training script will run stale code. Auto-save prevents that.
Step 4: Terminal Integration
VS Code's integrated terminal is where you run training scripts, monitor GPUs, and manage environments.
Set it up properly:
{
"terminal.integrated.defaultProfile.osx": "zsh",
"terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.fontSize": 13,
"terminal.integrated.scrollback": 10000
}
Useful shortcuts:
| Action | macOS | Linux/Windows |
|---|---|---|
| Toggle terminal | Ctrl+` |
Ctrl+` |
| New terminal | Ctrl+Shift+` |
Ctrl+Shift+` |
| Split terminal | Cmd+\ |
Ctrl+Shift+5 |
Split terminals are useful: one for running your script, one for monitoring GPU with nvidia-smi -l 1 or watch -n 1 nvidia-smi.
Step 5: Remote Development (SSH into GPU Boxes)
This is the most important extension for AI work. You will run training on remote machines (cloud VMs, lab servers, Lambda, Vast.ai). Remote SSH lets you open the remote filesystem, edit files, run terminals, and debug as if everything were local.
Setup:
- Install the Remote SSH extension (done in Step 2).
- Press
Ctrl+Shift+P(orCmd+Shift+P), type "Remote-SSH: Connect to Host". - Enter
user@your-gpu-box-ip. - VS Code installs its server component on the remote machine automatically.
For passwordless access, set up SSH keys:
ssh-keygen -t ed25519 -C "your-email@example.com"
ssh-copy-id user@your-gpu-box-ip
Add the host to ~/.ssh/config for convenience:
Host gpu-box
HostName 203.0.113.50
User ubuntu
IdentityFile ~/.ssh/id_ed25519
ForwardAgent yes
Now Remote-SSH: Connect to Host > gpu-box connects instantly.
Alternatives
Cursor
cursor.com is a VS Code fork with built-in AI code generation. It uses the same extension ecosystem and settings format. If you use Cursor, everything in this lesson still applies. Import the same settings.json and extensions.json.
Windsurf
windsurf.com is another AI-first VS Code fork. Same story: same extensions, same settings format, same Remote SSH support.
Vim/Neovim
If you already use Vim or Neovim and are productive in it, stay there. The minimum setup for AI Python work:
- pyright or pylsp for type checking (via Mason or manual install)
- nvim-lspconfig for language server integration
- jupyter-vim or molten-nvim for notebook-like execution
- telescope.nvim for file/symbol search
- none-ls.nvim with black and ruff for formatting/linting
If you do not already use Vim, do not start now. The learning curve will compete with learning AI engineering. Use VS Code.
Use It
With this setup, your daily workflow looks like:
- Open the project folder in VS Code (or connect via Remote SSH to a GPU box).
- Write Python in the editor with autocomplete, type hints, and inline errors.
- Run Jupyter notebooks inline with the Jupyter extension.
- Use the integrated terminal for training scripts,
uv pip install, and GPU monitoring. - Review changes with GitLens before committing.
Exercises
- Install VS Code and all extensions listed in Step 2
- Copy the
settings.jsonfrom this lesson into your VS Code config - Open a Python file and verify that Pylance shows type hints and Black formats on save
- If you have access to a remote machine, set up Remote SSH and open a folder on it
Hints
Exercise 1. Install the extensions from the table in Step 2, or install each ID in code/vscode/extensions.json with code --install-extension <id>. Run code --list-extensions and check each ID against the file.
Exercise 2. Open Settings > Open Settings (JSON) and copy the content of code/vscode/settings.json into it. If the file already has settings, merge the keys and keep valid JSON; VS Code marks a broken file with a red line.
Exercise 3. Write a function with a type annotation, then hover on a call to it; Pylance shows the inferred type. Add extra spaces in a line and save the file; Black must reformat the line on save.
Exercise 4. Add the server to ~/.ssh/config first and confirm that ssh <host> works in a terminal. Then use the Remote SSH command to connect; the status bar shows the host name when VS Code runs on the remote machine.
Key Terms
| Term | What people say | What it actually means |
|---|---|---|
| LSP | "Autocomplete engine" | Language Server Protocol: a standard for editors to get type info, completions, and diagnostics from a language-specific server |
| Pylance | "The Python plugin" | Microsoft's Python language server using Pyright for type checking and IntelliSense |
| Remote SSH | "Working on the server" | VS Code extension that runs a lightweight server on a remote machine and streams the UI to your local editor |
| Format on save | "Auto-prettier" | The editor runs a formatter (Black, Ruff) every time you save, so code style is always consistent |
Check yourself
Quick quiz
What is a Language Server Protocol (LSP)?
- A protocol for transferring files between editors
- A compression format for source code files
- A network protocol for remote pair programming
- A standard for editors to receive type info, completions, and diagnostics from a language-specific server
Show the answer
D. A standard for editors to receive type info, completions, and diagnostics from a language-specific server LSP is a standardized protocol that lets editors communicate with language servers for features like autocomplete, type checking, and error diagnostics, regardless of the editor used.
Why is format-on-save useful for team projects?
- It ensures consistent code style across all contributors without manual formatting
- It compresses the code for faster git operations
- It reduces file sizes by removing whitespace
- It catches runtime bugs before the code is executed
Show the answer
A. It ensures consistent code style across all contributors without manual formatting Format-on-save runs a formatter (like Black or Ruff) every time you save, ensuring all code follows the same style conventions regardless of who wrote it.
Which VS Code extension enables editing code on a remote GPU machine as if it were local?
- Pylance
- Debugpy
- GitLens
- Remote SSH
Show the answer
D. Remote SSH Remote SSH installs a lightweight VS Code server on the remote machine and streams the UI to your local editor, letting you edit files, run terminals, and debug remotely.
Why should 'notebook.output.scrolling' be enabled in VS Code settings for AI work?
- It enables smooth scrolling animations in the editor
- It allows scrolling between notebook cells with the mouse wheel
- It enables horizontal scrolling for wide dataframes
- It prevents training loop output (thousands of lines) from exploding the output panel
Show the answer
D. It prevents training loop output (thousands of lines) from exploding the output panel Training loops can print thousands of lines of output. Without output scrolling, the notebook output panel grows unbounded, making the notebook unusable.
What does setting 'python.analysis.typeCheckingMode' to 'basic' in VS Code accomplish?
- It enables syntax highlighting for Python files
- It formats Python code according to PEP 8 standards
- It enables Python 3.12 language features
- It catches wrong argument types and tensor shape mismatches before running the code
Show the answer
D. It catches wrong argument types and tensor shape mismatches before running the code Basic type checking with Pylance flags type mismatches, wrong argument types, and incorrect API parameters at edit time, catching bugs before you run a potentially expensive training script.
Questions people ask
What is the best code editor for AI and Python work?
VS Code is the most common choice, with Python, Jupyter and AI assistant extensions. Cursor is a VS Code based editor built around AI help. PyCharm is a strong Python-focused option. The best one is the one your team agrees on and configures the same way.
Are AI coding assistants safe to use on company code?
They can be, with care. Check the tool's data and retention policy, use business plans that exclude your code from training when available, keep secrets out of files the assistant reads, and review every suggestion before it is merged.
Lessons from AI Engineering from Scratch by Rohit Ghumare and contributors, MIT license. Notes for owners by Lozo. License