microsoft / microsoft/vscode-cmake-tools

Provide (default) configurations for sources not listed in CMakeLists.txt, based on file type

Open
#2,530 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

### Brief Issue Summary

Currently, if the C/C++ extension doesn't receive a custom configuration from CMake Tools for a file, it will opportunistically fall back to using the `compilerPath` and `compilerArgs` provided with the custom browse configuration (a `WorkspaceBrowseConfiguration`). Unfortunately, the `WorkspaceBrowseConfiguration` might apply only to C++ files and not C files, or vice versa, as it contains only a single `compilerPath` and `compilerArgs`.

Perhaps CMake Tools could provide appropriate default configurations for files not included in any CMakeLists.txt? If CMake Tools has sufficient information to provide the default `compilerPath` and `compilerArgs` (as it's already is for the `WorkspaceBrowseConfiguration`), but based on a type of file, it could provide that as a configuration for that type of file.

That might let us to remove the current fallback logic, which is currently hindered by the existence of only a single `compilerPath` and `compilerArgs`. More information on that can be found here:

https://github.com/microsoft/vscode-cpptools-api/issues/42
https://github.com/microsoft/vscode-cpptools/issues/9266

### CMake Tools Diagnostics

_No response_

### Debug Log

_No response_

### 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

Start by tracing how CMakeLists.txt sources and WorkspaceBrowseConfiguration data are represented in CMake Tools, including the compilerPath and compilerArgs passed to the C/C++ extension. Review the related vscode-cpptools issues for API constraints. Done means files absent from CMakeLists.txt receive appropriate defaults based on file type, without relying on the single shared fallback configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cmake, cpp, typescript
Domain
build-system, developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.