microsoft / microsoft/vscode-cmake-tools

[Feature] "Compile Active File" for headers

Open
#4,371 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

Request Overview

In CLion, I can do the equivalent of "Compile Active File" and it does something reasonable rather than failing saying there's no way to build headers (which is correct, of course, but useless).
To me, Something Reasonable is:

  1. Find the same-named .cpp or .c file as close as possible in the file tree that has an #include that includes the header in question.
  2. If that fails, look for ${basename}*.{cpp,c} that includes the header (this would find test-drivers for header-only includes.
  3. If that fails, (e.g., for a header-only header), find the closest file in the file tree that #includes the header in question and build that.

That's the fancy way -- but better than nothing would be to find any .cpp file that includes the header in question and build that. In my mind, "Compile Active File" means "I want to see what the compiler makes of the file I'm looking at."

Related:

  • #3709
  • #3845
Additional Information

No response

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

The issue names no files or tests. Start by tracing the existing “Compile Active File” command and review related issues #3709 and #3845; define the source-selection behavior above, then verify the command builds a suitable includer for headers.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cmake, cpp, typescript
Domain
build-system, developer-experience
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.