LEARN · DEEP GUIDE
VS Code
Navigate and work in the club project folder
An editor within a development system
A code editor lets you create, navigate, and change source text. A development environment connects that editing to language analysis, terminals, version control, build tools, and debugging. VS Code provides the workbench and extension interfaces that connect these services. It does not become a C++ compiler simply because a file ends in .cpp.
Imagine editing a Mega program. VS Code displays the text; a C++ language service analyzes it for completion and diagnostics; PlatformIO selects the target environment and invokes compiler/linker tools; an upload tool communicates with the board; Git records reviewed changes. These processes exchange information but do not all have the same authoritative view of success. An editor squiggle, build error, and upload error come from different stages.
For a Raspberry Pi application, the arrangement can differ again. VS Code can display a remote filesystem over SSH while a Python process runs under Linux on the Pi. That process is not firmware uploaded into a Mega's flash. Identify where files live, where commands execute, and which computer controls the attached hardware before drawing conclusions from the interface.
Open the whole project
A folder provides project context. Explorer shows its files, workspace search uses its scope, terminals usually start relative to an intended root, and extensions discover configuration. Open the directory containing platformio.ini for a PlatformIO project. Opening only a source file does not present all the information needed to interpret dependencies or select a build environment.
A workspace can contain one folder or several folders described by a .code-workspace file. A multi-root workspace is useful when related repositories need simultaneous inspection, but each repository and configuration still has its own boundaries. Do not assume a command in one terminal operates on every folder shown in Explorer.
The saved disk file and the editor buffer are separate states. Unsaved edits can be visible in the editor while a command reads the prior saved file. Some task integrations save automatically according to settings, but relying on that implicitly makes diagnosis harder. Establish what was saved and which path the task read.
Auto Save changes when a buffer is written to disk according to its settings. It does not stage a Git change, commit a snapshot, or upload firmware. Confirm those separate operations explicitly.
When the wrong repository appears in Source Control or searches miss files, inspect the workspace root before changing code. A folder opened one level too high can include several projects; a folder too low can hide configuration. In a terminal, git rev-parse --show-toplevel identifies Git's root, while Get-Location in PowerShell or pwd in a Linux shell identifies the shell's current directory.
Reading the interface
Explorer represents files and directories. Editor tabs identify open buffers, sometimes with preview behavior that reuses a tab until it is pinned by normal interaction. The bottom panel can host Problems, Output, Terminal, and debug views. The status bar exposes contextual information such as language mode, repository branch, line endings, and remote connection.
Problems aggregates diagnostics produced by extensions and tooling. Output channels contain tool-specific logs. The terminal is an interactive shell. These are distinct sources of information. A missing include in Problems should be compared with the actual build output; a terminal command failure should be inspected in that shell's context.
The Command Palette searches actions rather than file text. It is a dependable entry point when a menu location changes: search for the intended action, such as opening settings, selecting a formatter, or connecting to a remote host. Menu icons can vary by extension and version; action names and tool logs provide more stable clues.
Navigating code and information
Quick Open searches filenames and paths. Workspace search searches text content. Use the former when you remember the file; use the latter when you remember a symbol, error, configuration key, or phrase. This distinction makes a large project navigable without guessing its entire folder hierarchy.
Go to Definition follows a symbol to the declaration or implementation the language service resolves. Find References finds semantic uses within its available project information. Rename Symbol can update those uses more safely than a blind text replacement. These actions rely on the language service's configuration and index; macros, generated code, and incomplete environments can limit the result.
A text search for pin finds every matching string, including comments and unrelated identifiers. A semantic search for references to ledPin asks about a particular symbol. Use both tools according to the question. Text search is often better for configuration keys or plain Markdown; semantic navigation is better for a renamed member function across C++ files.
Breadcrumbs and outline views expose structural context within a file. In a long guide or source file, headings or symbols can be more useful than scrolling. These views reduce navigation cost but do not imply that every tiny section should be a separate file.
Editing and refactoring
Indentation communicates nesting to humans while braces and syntax determine C++ structure. Formatting applies a consistent representation without deliberately changing meaning. A formatter is different from a linter, which diagnoses configured patterns, and from the compiler, which translates according to language and target rules. Several tools can report on the same text for different reasons.
Choose a project-appropriate formatter and avoid multiple extensions competing to format on save. If a file suddenly changes style, inspect workspace settings, language-specific settings, and the selected formatter. A formatting-only diff can obscure a small behavioral change, so keep the reviewable purpose of a commit in mind.
Multiple cursors are useful for repetitive edits where the same textual change is intended. They are not a substitute for understanding each selected location. Rename Symbol is usually preferable when changing a program identifier because it can distinguish unrelated names. For a refactor, verify the resulting diff and build rather than assuming the editor operation guaranteed correctness.
Comment toggling, line movement, and bracket matching reduce clerical work. They do not replace reading scope. A visually selected block that omits a closing brace can cause a cascade of errors. When diagnostics multiply after an edit, check the structural change first.
The terminal is a shell
The integrated terminal runs a shell inside the workbench. PowerShell, Command Prompt, Bash, and a remote Linux shell interpret commands differently. mkdir GitHub creates a directory in the current location; cd GitHub changes the current directory. Neither command downloads a repository. git clone does that work after a suitable destination has been selected.
A shell finds programs through paths and environment configuration. “Command not found” can mean the executable is absent or that the shell cannot discover it. PlatformIO's extension-managed terminal may know where pio is even when a separate PowerShell window does not. Restarting or configuring the appropriate environment can resolve discovery; changing firmware logic cannot.
Get-Location
git status
pio run -e megaatmega2560These are example inspections and a build invocation for a configured project. The current directory and selected environment determine their scope. A terminal that was opened earlier can remain in a different directory from the file currently displayed in the editor. Changing tabs does not necessarily change that terminal's working directory.
Tasks automate command invocations with configuration. A task can compile, validate, or run another tool, but its working directory, environment, and arguments still matter. Read a task definition when its behavior is unclear. The presence of a convenient button does not make those inputs irrelevant.
Source Control as a Git interface
VS Code's Source Control view is a UI over Git's working tree, index, and history. Clicking a changed file opens a comparison; staging chooses content for the index; committing records the index. Built-in Git support does not require GitLens, though extensions can add history and review capabilities.
Review the diff and stage deliberately. A file can appear with both staged and unstaged changes if it was edited after staging. A commit action records the staged version under ordinary Git semantics. The Git guide explains those states; the graphical interface should be interpreted through that model.
Buttons described as synchronization can combine network operations. When the exact effect matters, use explicit fetch, inspection, and chosen integration/push commands or inspect the action's documentation. A branch shown in the status bar is useful context, but verify the intended repository when a workspace includes several.
If changes do not appear, run git status in the relevant folder. The file may be ignored, outside the repository, unsaved, or in another checkout. An extension icon being absent is not evidence that Git history vanished.
Language services and diagnostics
Syntax highlighting classifies tokens for display. Completion suggests names or patterns. A language service parses and indexes source, resolves symbols, and produces diagnostics using its configured view of the project. A C++ service needs information such as include paths, definitions, target compiler, and language standard to approximate the compiler's context.
PlatformIO can supply environment data to the C++ tooling. If that integration is stale or the wrong environment is selected, the editor can report a missing header even when the target build succeeds. Conversely, the editor may accept a construct using a host-like configuration that the AVR compiler rejects. Compare both results before deciding which layer is broken.
Pylance supplies Python language analysis; it does not diagnose C++ firmware. In a repository containing scripts as well as web or firmware sources, Python diagnostics can concern only those scripts. The interpreter selected for analysis can differ from the executable a terminal command invokes. Check both selections for import and environment issues.
An error in an archived .cpp file outside the selected source set may never enter the firmware build. It can still indicate invalid code in that file. Distinguish “this source has a problem” from “this source caused the current build to fail.” Do not suppress a whole directory simply to hide a diagnostic without checking whether it is intended to be compiled later.
Reference: C/C++ IntelliSense configuration.
Extensions, settings, and profiles
An extension adds capabilities through VS Code's APIs. Extension hosts run extension logic; language servers and tool processes can perform additional work. Installed does not mean active in every window. Some extensions activate only for particular languages, workspace conditions, or local/remote contexts.
Install capabilities for an actual task and understand their responsibilities. PlatformIO manages embedded project tooling; C/C++ tooling analyzes code; Remote - SSH connects a remote development context. Several formatters or language providers can create conflicting behavior, increased indexing work, or confusing diagnostics. Your notes' installed-extension list is a dated observation, not a required installation recipe for every club member.
User settings apply broadly. Workspace settings apply to the relevant project and can override user choices; language-specific settings add another context. JSON settings expose exact keys, while the UI helps discover them. A shared workspace setting should describe a team choice, not expose personal absolute paths or force an unrelated extension collection.
Keybindings can be changed by users and extensions and differ across operating systems. Profiles can organize different settings/extension sets for different work. When a shortcut behaves unexpectedly, inspect the binding currently active rather than arguing with a printed cheat sheet.
Remote SSH from first principles
SSH provides an authenticated, encrypted connection to a remote machine. A remote shell executes commands there, using that machine's filesystem, installed programs, and permissions. It does not merely display a local folder with a different title. Connecting to the wrong host can mean editing and running the wrong project even when filenames look familiar.
VS Code Remote - SSH keeps the visible UI local while installing and using a server component on the remote host. The remote side gives the editor access to remote files and runs extensions that belong to that environment. A terminal in the remote window normally executes remotely. Some UI extensions remain local; extension placement depends on their role.
A Raspberry Pi running Linux can host a project, Python interpreter, camera libraries, and processes that interact with its GPIO. Opening that folder through Remote - SSH edits the Pi's actual files. Running Python there starts a Linux process. Copying a file to the laptop or switching to a local window creates a different context, even if the editor still looks similar.
The practical entry sequence is to establish that the Pi is running and reachable, verify SSH access with the intended account/host, use Remote - SSH to connect, then open the remote project directory. Confirm the remote indicator and run a simple location/host inspection in the remote terminal. Configure the relevant remote interpreter or tools. This guide provides the model; a future Pi project must specify its own hostname, account, setup, and dependencies.
Do not weaken host-key checks casually when a connection warns of an identity mismatch. A changed image can legitimately alter a host key, but a mismatch should be explained and verified against the intended machine. Authentication, network reachability, server setup, and application failure are different diagnostic stages.
Reference: VS Code Remote - SSH.
- local UIconnect →
- SSH transportreach →
- remote serveraccess →
- remote fileswork in →
- remote shelllaunch →
- remote Python process
Local UI connects through SSH; remote server accesses files and remote terminal launches a process.
Keep host identity visible and do not depict code upload to MCU flash.
Diagram labels
local UI · SSH transport · remote server · remote files · remote shell · remote Python process
Debuggers and embedded limits
A debugger can pause execution at breakpoints, inspect state, and step through instructions or source. A debug configuration selects the executable, target, adapter, and connection method. The editor presents controls, but the underlying target must support the requested operations.
The Variables view shows values in the selected execution context. The Call Stack shows the chain of active calls as frames; selecting a frame changes which locals and source location you inspect. This helps distinguish a wrong input from a wrong calculation. An optimized firmware build may omit values or rearrange instructions, so source-level stepping need not resemble one statement per visible stop.
For a Linux Python process, a suitable debug adapter can instrument or control that process. For firmware, a supported probe or stub and target configuration may be required. USB upload capability does not imply hardware breakpoint debugging capability. The standard Mega board does not contain an onboard debug probe ready for an arbitrary desktop-style debug session.
Pausing execution can alter time-sensitive behavior. A motor control loop, communications timeout, or watchdog may behave differently under breakpoints. Serial logging can also affect timing. Choose a diagnostic method that observes the relevant state without invalidating the behavior under study.
Reference: debugging concepts.
Reference and a diagnosis workflow
| Windows default or action | Purpose |
|---|---|
Ctrl+Shift+P | Search commands/actions |
Ctrl+P | Find a file by name/path |
Ctrl+F | Search current file text |
Ctrl+Shift+F | Search workspace text |
Ctrl+Backtick | Toggle integrated terminal |
F12 | Go to Definition where supported |
Shift+F12 | Find References where supported |
F2 | Rename Symbol where supported |
| Open Settings / Keyboard Shortcuts | Inspect actual configuration/bindings |
These are defaults, not guarantees about a customized installation. For a confusing result, determine the open root, saved file, current shell location, local/remote context, selected environment, and producer of the diagnostic. Then test the specific layer with its own tool. This approach makes VS Code an understandable workbench rather than a collection of icons whose effects must be memorized.