microsoft / microsoft/vscode-cpptools

Compile single file, Preprocess single file

Open
#8,345 5 comments 17 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request help wanted Language Service tasks/build/debug
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: Feature Request

In a separate discussion regarding compile_commands.json I outlined that the data contained within this json could be a great stepping-off point for a compile single file / preprocess single file feature in vscode: https://github.com/microsoft/vscode-cpptools/discussions/8308

Since the json has the path to the compiler and all the compiler arguments, it's all the information one needs to implement this feature. Typically compile single / preprocess single typically decorates a TU alongside a module compilation unit, its frequently overlooked, and tricky to add later (omit sibling TUs, skip calling linker). It's not unreasonable to "compile" arbitrary .h files, anything with compiler rules, just to a temp object. Likewise with preprocessing a file, it doesn't matter if the file in question is directly mentioned in a module build unit to be able to preprocess and present the preprocessor output in a temp document.

These features are useful in a tight iteration loop because full-bore builds may consider dozens or hundreds of units that end up generating redundant errors, and waste precious seconds delivering a round of errors into the eyeballs of the engineer. Likewise, preprocessing a file to a temp is a key iteration loop when authoring and testing tricky macro expansions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked compile_commands.json discussion and the vscode-cpptools extension context to understand how compiler paths and arguments are exposed. The feature would be complete when a selected file can be compiled or preprocessed independently, producing a temporary object or preprocessor-output document without running the full build or linker.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
build-system, compilers, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.