microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.45k stars 1.53k forks source link

Extensible compiler querying #6931

Open Colengms opened 3 years ago

Colengms commented 3 years ago

To support compilers cpptools does not know how to query for system includes and system defines, perhaps the compiler querying logic could be separated out into user-serviceable definition files. Users with unsupported compilers would have the option of composing their own compiler-query-definition file, and provide all of the necessary information to query the compiler for system include paths and system defines, and translate args for defines and includes, as well as args that should influence how the IntellIiSense process is configured (language standard, IntelliSenseMode).

sean-mcmanus commented 3 years ago

I'm not sure what the "definition files" would be. One current workaround is to provide a compiler or script that mimics the output we except from gcc/clang compilers.

Colengms commented 3 years ago

In addition to needing a way to query unknown compilers for system includes and system defines, there is also the fact that scanning the command line for user includes and defines may fail due to an unknown command line syntax. I guess I'm proposing making both the compiler querying and command line arg parsing logic 'data driven' rather than hard-coded, and providing a way for users to add support for additional compilers by composing their own data to drive those operations.

github-actions[bot] commented 3 years ago

This feature request has received enough votes to be added to our backlog.

ytsarko commented 2 years ago

Hi @sean-mcmanus and @Colengms,

As of moment of writing this feature request is in Backlog. Are there any plans to start working on it? When tentatively?

It will be really cool to have it implemented so that users will be able to configure currently unsupported compilers without your support. This is especially true for different proprietary compilers that require special licenses or NDAs.

sean-mcmanus commented 2 years ago

If/when we have a tentative plan we would add it to specific milestone.

bobbrow commented 6 months ago

Tagging a few compiler issues that may benefit from this feature. #11852 #7653 #7146 #6798 #6677 #6642 #3222 #2499

KnoerleMaTLS commented 4 months ago

I'm not sure what the "definition files" would be. One current workaround is to provide a compiler or script that mimics the output we except from gcc/clang compilers.

@sean-mcmanus, since this feature is still not available yet it would be awesome if you could provide more information about the workaround you mentioned. Especially the script part would be interesting, since this already looks like the initial feature request of this issue. This is really a huge and painful issue for the embedded development world.

KnoerleMaTLS commented 4 months ago

Furthermore the requested feature should not be that hard to implement, imho. Please correct me if I'm wrong.

This seems to be the compiler query process in my use case: image

I don't know if there's more magic going on that isn't visible, but if not, a simple solution might look like this:

Step 1: Introduce a new setting to the extension which provides the option to select to use a local configuration file for compiler configuration or use the actual default detection mechanism (default).

Step 2: Publish a json schema which must be fulfilled by the user if he want to provide the compiler configuration by himself.

Step 3: You are done and have satisfied dozens of users.

I really don't understand why such a crucial feature is still not implemented three years later. Does no one develop embedded systems that use a microcontroller these days?