computing-setup/03-editors/README.md
Eric Furst 36d4fda5aa Tighten prose punctuation across READMEs
Reduce colon overuse and tighten em-dash phrasing for readability.
Add .gitignore for devlog and CHANGES.
2026-05-29 09:53:40 -04:00

180 lines
11 KiB
Markdown

# Editors
## Key idea
A good editor is the cockpit you work from every day. It is worth a little setup to make it serve you well, including the AI extensions that most engineers now use as part of their daily workflow.
## Key goals
- Install a modern code editor (VS Code recommended) and the essential extensions
- Add an AI coding extension and understand the basic options
- Configure a few editor settings that pay back the small investment quickly
- Know where to learn the *workflow* of using these tools. This module is setup, not practice.
---
## 1. Editor vs IDE vs text editor
A quick taxonomy:
- **Text editors** (TextEdit, Notepad) edit text. They do not know anything about programming languages, projects, or version control. Fine for a quick note; not what you want for code.
- **Code editors** (VS Code, Sublime Text, Neovim with plugins) understand programming languages: syntax highlighting, autocompletion, integrated terminal, version-control awareness, extensions for almost everything.
- **IDEs** (PyCharm, IntelliJ IDEA, Visual Studio, Xcode) are heavier code editors tailored to a specific language or platform, with deeper refactoring tools and built-in build systems. Powerful but with more to learn.
- **Terminal-based** (steep learning curves, devoted user bases):
**Neovim.** A modern Vim fork. The AI plugins like copilot.vim, avante.nvim, codecompanion.nvim are mature.
**Emacs.** Also venerable, cross-platform, with AI packages like copilot.el and gptel.
For a general-purpose scientific computing setup, a code editor is the sweet spot. VS Code is the most widely used today and is what this module installs.
## 2. Recommended: Visual Studio Code
**Visual Studio Code** (commonly just "VS Code") is a free, open-source code editor from Microsoft. It runs on macOS, Linux, and Windows; has a large extension ecosystem; integrates with WSL, SSH, and containers; and is the default home for most AI coding extensions.
A few alternatives worth knowing exist but aren't installed here:
- **Cursor** and **Windsurf**. Forks of VS Code with deeper AI integration baked in (instead of bolted on as extensions). Same shortcuts, same UI, similar extension support. If you find yourself doing heavy agentic work, worth a look.
- **PyCharm** (Community Edition is free). Heavier IDE, strong refactoring tools, popular among Python-focused teams.
- **Neovim** with AI plugins. For the terminal-first crowd. Steep learning curve, satisfying for those who learn it.
- **Zed**. A newer, performance-focused editor with growing AI features.
Switching editors later is not a major event. Start with VS Code; revisit if you have a specific reason.
## 3. Install VS Code
### macOS
The easiest path is [Homebrew](https://brew.sh/):
```bash
brew install --cask visual-studio-code
```
Or download the `.zip` from [code.visualstudio.com](https://code.visualstudio.com/) and drag `Visual Studio Code.app` into `/Applications/`.
### Linux
Use your distribution's package manager, or download from [code.visualstudio.com](https://code.visualstudio.com/). For Debian/Ubuntu:
```bash
sudo apt update
sudo apt install -y code # if your apt sources include the VS Code repo
```
If not, the download page has a `.deb` you can install with `sudo apt install ./code_*.deb`.
### Windows (with WSL)
Install VS Code on the **Windows** side, not inside WSL — there is one installation, and VS Code connects into your WSL environment via the **WSL extension** (see Section 5).
Download the installer from [code.visualstudio.com](https://code.visualstudio.com/) and run it. Accept the option to "Add to PATH" so you can open files from the terminal with `code <file>`.
### Verify the install (all platforms)
After installing on any OS, open a terminal and run:
```bash
code --version
```
You should see version numbers. If the command is not found, VS Code is not on your PATH. Fix it as follows:
- **macOS:** open VS Code and run *Shell Command: Install 'code' command in PATH* from the command palette (`Cmd+Shift+P`).
- **Linux:** package-manager installs put `code` on the PATH automatically. A manually downloaded `.deb` or tarball may not. Re-run the package installer or follow the instructions on the download page.
- **Windows:** re-run the Windows installer and tick the "Add to PATH" option, or add the install directory manually. On Windows with WSL, the `code` command works from both PowerShell *and* your WSL shell (the WSL extension installs a shim inside WSL).
## 4. Essential extensions
VS Code is barebones until you install extensions. Open the **Extensions** view (`Cmd+Shift+X` on macOS, `Ctrl+Shift+X` elsewhere) and install:
| Extension | Purpose |
|---|---|
| **Python** (Microsoft) | Python language support, debugging, environment selection |
| **Pylance** (Microsoft) | Fast Python type checking and intellisense (usually installs alongside Python) |
| **Jupyter** (Microsoft) | Run `.ipynb` notebooks inside VS Code |
| **GitLens** | Inline blame, history, file/line annotations from git |
| **EditorConfig for VS Code** | Honor `.editorconfig` files for consistent formatting across editors |
| **WSL** (Microsoft, Windows users only) | Open WSL folders directly from Windows VS Code; the editor runs in Windows, the language tools run in WSL |
| **Remote - SSH** (Microsoft) | Open folders on a remote server over SSH as if they were local |
Install the first five for any setup; add WSL if you are on Windows, and Remote - SSH if you will ever work on a remote machine.
## 5. AI coding extensions
This is where AI integration enters your daily workflow. As of early 2026, the major options are:
| Extension | Notes |
|---|---|
| **GitHub Copilot** | Long-running, mature extension. Free for students via [GitHub Education](https://education.github.com/). Paid otherwise. Includes inline suggestions and a chat panel. |
| **Microsoft Copilot for VS Code** | Microsoft's broader Copilot integration. Often available to students through university Microsoft 365 agreements (check with your institution). |
| **Claude for VS Code** | Anthropic's official extension. Strong for explanation and reasoning, plus an agentic mode that integrates with Claude Code. Subscription-based. |
| **Codeium** | Free tier for individuals, paid for teams. Good baseline if cost is a factor. |
| **Gemini Code Assist** | Google's offering. Often available through Google Workspace for Education agreements. |
**Recommendation: install one to start.** Which one depends on what you already have access to:
- If you have free Copilot through GitHub Education, start with **GitHub Copilot**.
- If your university provides Microsoft 365 or Google Workspace, check whether **Microsoft Copilot** or **Gemini Code Assist** is included — it usually is, and there is no point paying for something you already have.
- If none of the above, **Codeium** is the lowest-friction starting point.
- If you specifically want strong agentic features, **Claude for VS Code** (paired with the `claude` CLI) is the most integrated path today.
You can install more than one, but they will fight over the autocomplete trigger. Pick one for autocomplete and configure the others (if any) for chat-only use, or just stick to one.
### Installing the extension
The pattern is the same for all of them:
1. Open the Extensions view (`Cmd+Shift+X` / `Ctrl+Shift+X`)
2. Search for the extension name
3. Click **Install**
4. Sign in when prompted (each tool has its own account / authentication flow)
5. Reload VS Code if asked
After installation, you should see inline suggestions begin to appear as you type in a code file, and a chat panel becomes available (usually via a sidebar icon or `Cmd+I` / `Ctrl+I`).
**A note on cost and policy:** AI coding extensions send your code to the provider's servers to generate suggestions. Free tiers and paid tiers often have different data-handling policies (free tiers historically have been more likely to use submitted code for training). Check your institution's policy and the extension's privacy statement before using one for sensitive or proprietary code.
## 6. Settings worth knowing
Open Settings with `Cmd+,` (macOS) or `Ctrl+,` (elsewhere). A few that pay back the small investment:
- **Settings Sync** (the gear icon in the bottom-left → *Backup and Sync Settings*). Syncs your settings, extensions, and keybindings across machines using a GitHub or Microsoft account. Set up once; saves an afternoon every time you set up a new machine.
- **Integrated Terminal** (`` Ctrl+` `` / `` Cmd+` ``) — VS Code has a terminal built in. On Windows, you can set the default profile to WSL (open the terminal, click the dropdown next to the `+`, choose **Select Default Profile**, pick **Ubuntu** or your WSL distro).
- **Format on Save.** Settings → search for *Format On Save* → enable. Combined with a formatter extension (e.g., **Black** for Python, **Prettier** for JS/TS), this auto-formats every save.
- **Auto Save.** Settings → search for *Files: Auto Save* → set to `afterDelay` if you want VS Code to save automatically. Some people love it, some hate it; try it for a week.
- **Themes** — `Cmd+Shift+P`*Color Theme*. Cosmetic, but you stare at this thing for hours. Pick one you can read comfortably.
## 7. Verify the setup
Open a terminal in VS Code (`` Ctrl+` `` or `` Cmd+` ``) and try:
```bash
code --version
python --version
git --version
```
Then create a small Python file, start typing a function signature, and see whether your AI extension offers a completion. If it does, you are set up.
## Where to go next
This module covered *setup*. Knowing **when** to copy-paste, **when** to use the editor, and **when** to use agents (and how to use each well) is the subject of a companion guide:
- [**coding-with-ai**](https://lem.che.udel.edu/git/furst/coding-with-ai). Working effectively with AI coding assistants. The natural next step once your editor is configured.
## Exercises
> **Exercise 1:** Install VS Code and the essential extensions from Section 4. Open the integrated terminal and confirm `python`, `git`, and (on Windows) WSL are reachable.
> **Exercise 2:** Install one AI extension. Sign in. Open a small Python file and try (a) inline autocomplete on a new function, and (b) the chat panel asking *"explain what this function does"* on a function you already have.
> **Exercise 3:** Enable Settings Sync and pick a theme you can read for an hour without eye strain. Set Format on Save with an appropriate formatter for your primary language.
> **Exercise 4:** Add an entry to your machine log (see Section 8 of [Know Your Machine](../01-know-your-machine/)): which editor and extensions you installed, which AI extension you picked, and any settings you customized. Future-you will appreciate the record.