microsoft / microsoft/vscode-cpptools

Expose "effective" SourceFileConfiguration to other extensions

Open
#5,038 4 comments 63 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request Feature: Extension API Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Hi,

Context: I am a developer of the SonarLint static code analyzer. We (SonarSource) have a C/C++ analyzer, and this is one of the most voted feature request by our users to add support of analyzing C/C++ code in VSCode:
https://community.sonarsource.com/t/sonarlint-for-vscode-c-c-support/4732/9
https://community.sonarsource.com/t/sonarlint-vscode-cfamily-support/14566/4

In order to analyze C/C++ source files, our analyzer needs to know compilation settings (compiler, flags, includes, ...). I started to study your extension, and discovered c_cpp_properties.json configuration file, as well as the ability for third party extensions to contribute configuration directly using the extension API:
https://github.com/microsoft/vscode-cpptools-api/blob/master/api.ts#L137

I found very similar requests (https://github.com/microsoft/vscode-cpptools/issues/1524, https://github.com/microsoft/vscode-cpptools/issues/3978) that were closed after the active configuration was exposed, and suggesting to rely on c_cpp_properties.json. But to me this is not a good solution as configuration may also come from the provider api.

I wonder if you would be open to create a new API, not to contribute SourceFileConfiguration, but for a third party extension to read the effective SourceFileConfiguration (the one you will use on the language server side, after resolving all contributions, and maybe after resolving default compiler includes).

FYI we already did a similar collaboration with the Java team from Microsoft, to enable Java code analysis :)
https://github.com/SonarSource/sonarlint-vscode/pull/28#issuecomment-557228034

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 reading the extension API definition in api.ts and the existing c_cpp_properties.json and SourceFileConfiguration contribution paths. Trace how provider contributions and default compiler includes are resolved into the language server's effective configuration. Done means a documented read API exposes that resolved configuration to third-party extensions without changing the existing contribution API.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.