Skip to content

feat: decouple intellisense extension dependency#4463

Open
matthewmcneill wants to merge 4 commits into
platformio:developfrom
matthewmcneill:feat/intellisense-soft-deps
Open

feat: decouple intellisense extension dependency#4463
matthewmcneill wants to merge 4 commits into
platformio:developfrom
matthewmcneill:feat/intellisense-soft-deps

Conversation

@matthewmcneill
Copy link
Copy Markdown

@matthewmcneill matthewmcneill commented Apr 26, 2026

TL:DR: Decouples hardcoded extension ID lookups and implements a soft-dependency facade for IntelliSense engines to allow activation in open-source editors, and other platforms like Google Antigravity, that do not use the Microsoft restricted marketplace (e.g. instead use Open VSX).

Rationale

Historically, PlatformIO's VS Code extension relied on hardcoded identifier lookups (platformio.platformio-ide) and aggressive conflict management, which assumes a very standard Microsoft VS Code environment.
As developers increasingly migrate toward authorized open-source IDE variants and AI-agentic editors (such as Google's Antigravity IDE, Cursor, and VSCodium), these hardcoded assumptions either crash the extension or prevent fundamental features (like IntelliSense) from hooking into the workspace correctly.
This PR modernizes the extension’s architecture by decoupling it from strict environmental assumptions, converting rigid extension ID checks into a soft-dependency facade. This allows PlatformIO to organically activate and fully function inside non-standard VS Code forks without negatively impacting the native Microsoft VS Code experience.

Changes Included

  • Dynamic Extension Context Checking (src/main.js & src/utils.js):
    Removed hardcoded references to platformio.platformio-ide. IDE manifest fetches now safely failover if called prior to the context injection step, preventing uncaught initialization crashes in alternative editors.
  • Soft-Dependency Facade for Language Servers (src/constants.js):
    Registered ms-vscode.cpptools and llvm-vs-code-extensions.vscode-clangd dynamically.
  • Decoupled Extension Conflicts (src/constants.js & src/misc.js):
    Removed vscode-clangd from the CONFLICTED_EXTENSION_IDS array so it is no longer forcibly uninstalled/disabled.
  • Graceful User Warnings (src/misc.js):
    Implemented the warnMissingIntelliSenseEngine() routine to detect whether the user lacks an installed C/C++ engine, and prompts an optional, dismissible warning to install one, restoring choice to the user ecosystem.

Related Changes

FR: Official Support for Google Antigravity IDE #4417
platformio-node-helpers #24
fix: enforce strict python baseline < 3.13

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 26, 2026

CLA assistant check
All committers have signed the CLA.

@matthewmcneill
Copy link
Copy Markdown
Author

matthewmcneill commented Apr 26, 2026

Note : IntelliSense Data Generation & Clangd Parity

While this PR prevents clangd from being aggressively uninstalled and unlocks it for use, it's worth noting the current state of how the IntelliSense databases are generated:

Currently, when the extension rebuilds the project index upon a platformio.ini change, it executes pio project init --ide vscode. This command is hardcoded in the PlatformIO Core to emit .vscode/c_cpp_properties.json for the Microsoft C/C++ engine, but it does not generate the standard compile_commands.json required by Clangd.

As a result, a user utilizing the newly enabled Clangd workflow must manually generate their compilation database by running:

pio run -t compiledb

What was considered

I considered injecting a workaround into platformio-node-helpers (inside ProjectIndexer.rebuildWithProgress) to eagerly chain pio run -t compiledb immediately after the init task. However, I decided against implementing that hack here, as it introduces hidden background build steps and convolutes the helper logic.

Full Parity Roadmap

To achieve full "first-class" parity for Clangd out of the box, the ideal approach would be an upstream modification to platformio-core. Specifically, modifying the project init --ide vscode IDE generator script to naturally emit compile_commands.json into the .vscode/ directory (or root) alongside c_cpp_properties.json.

Since that requires changes in the core Python repository rather than the VS Code extension, I've left it out of scope for this immediate architectural decoupling PR.

Matt

@karandancer07-coder
Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants