IntelliSense Configuration

The extension automatically configures IntelliSense based on your build configuration.

Switching IntelliSense Provider

Run: onsemi: IntelliSense: Switch Provider

Choose between:

  • clangd: Modern, fast language server with excellent standards support

  • Microsoft C/C++: Traditional VS Code C/C++ extension

Refresh Configuration

After modifying build settings or changing configurations:

Run: onsemi: IntelliSense: Refresh configuration

This updates IntelliSense based on the current active build configuration.

Multi-Folder Workspaces (Active Folder)

In a workspace with multiple project folders, clangd needs to know which folder’s compilation database to use. The extension provides an Active Folder indicator in the VS Code status bar (visible when clangd is the active provider).

  • Click Active Folder in the status bar to pick which workspace folder clangd should index.

  • You can also run the command onsemi: IntelliSense: Select Active Folder from the Command Palette.

Switching the active folder reloads the clangd configuration (including any sub-project sidecars described below).

Sub-Project Switching (Superbuild / Multi-Core)

Some projects build more than one binary from the same source tree — for example, a superbuild that produces a primary-core binary and a co-processor binary (e.g. cm33 and lpdsp32) each with its own compiler, include paths, and compile_commands.json.

For these projects the extension shows an additional Active Sub-Project indicator in the status bar (visible when clangd is the active provider and the active folder contains at least one sub-project sidecar — see below).

  1. Build all sub-projects at least once so each has a compile_commands.json.

  2. Click the Active Sub-Project status bar item.

  3. Pick the sub-project you want IntelliSense for (e.g. cm33 or lpdsp32).

  4. clangd restarts automatically with that sub-project’s compiler path, arguments, and compilation database.

You can also run the command onsemi: IntelliSense: Select Active Sub-Project from the Command Palette.

Note

After switching sub-projects, allow a few seconds for clangd to reindex the workspace before navigation, completion, and diagnostics fully reflect the new context.

Sidecar Configuration Files

Sub-project switching is driven by sidecar configuration files stored under .vscode/ in each workspace folder:

.vscode/<subproject>_clangd.json

The extension watches this pattern and exposes one entry per matching file in the Active Sub-Project picker. Each sidecar is a small JSON document with the same keys VS Code’s clangd extension expects:

{
  "clangd.path": "C:/path/to/the/clangd-or-variant.exe",
  "clangd.arguments": [
    "--compile-commands-dir=C:/path/to/build/<subproject>",
    "--header-insertion=never"
  ]
}

When you select a sub-project, the extension applies the sidecar’s clangd.path and clangd.arguments to the clangd extension and restarts the language server. This lets a single workspace use a different clangd binary (for example, a vendor-specific clangd variant for a DSP core) and a different compile_commands.json per sub-project.

Note

Sidecar files are typically generated by the SDK’s CMake during configure. Re-run configure (onsemi: Project: Configure) if a sidecar is missing or out of date.

Troubleshooting IntelliSense

Red squiggles on valid code after building

Run onsemi: IntelliSense: Refresh configuration from the Command Palette.

Wrong includes shown for a sub-project’s source files

Make sure Active Sub-Project in the status bar matches the sub-project you are editing.

clangd not found or not starting

The clangd VS Code extension prompts you to download clangd the first time it is needed — accept the prompt to install it.

IntelliSense stale after changing presets or build configurations

Re-run configure (onsemi: Project: Configure, or build the project) to regenerate compile_commands.json, then run onsemi: IntelliSense: Refresh configuration.

Microsoft C/C++ extension conflicts with clangd

Use onsemi: IntelliSense: Switch Provider to select exactly one provider.