microsoft / vscode-cpptools

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

Documentation request how to specify include firs for intelisense and defines #11024

Open duaneellissd opened 1 year ago

duaneellissd commented 1 year ago

Feature Request

We build with makefile cross compiling

An in my makefile I can add a target to create a file that lists sec firs and include firs and active # defines for intellisense

what does not work is having viscose just select all h files under the project root for

reason: I have different( multiple) chip drivers in different sub directories the makefile has a macro/variable that controls the active target and configuration

Example top dir is BSP and under that dir are 5 different boards something like this BSP/boardname/include/board gpio.h and BSP/src/board gpio.c

thus a makefile target can create a file for intelisense

part 2 is how do I tell vs-code to forget and delete the intellisense database because it is lost or the configuration has changed and it needs to be rebuilt

what files do I delete to make that happen

sean-mcmanus commented 1 year ago

Have you tried installing the Makefile Tools Extension and setting configurationProvider to "ms-vscode.makefile-tools"? And maybe asking your question at https://github.com/microsoft/vscode-makefile-tools/issues ?

duaneellissd commented 1 year ago

i doubt that will help(i did install it no change) i do alot of gnu make tricks to create macros and i think the make parser just gets lost i am also generating the make files and fragments, in total the various makefiles are about 2 to 2.5meg

my assumption is the make file parser is choking on it and the ultimate goal would be or could be a json file (read by the intellasense parser) with information like a) the list of include directories and b) commandline defines and c) list of C files (nearly 1000) to parse and a list not to parse (about 200)

why do i have a list of files not to parse? i have a directory structure that has peripheral drivers for multiple targets (my driver library) . ie ArmCortex m0 in fpga, an directory for stm32 and microblaze and another for riscv so parsing *.c recursively finds all of those and is just bad really bad and ends up with multiple defines

sean-mcmanus commented 1 year ago

You could use a compile_commands.json file (compileCommands.json setting), which can have include directories and command line defines set, but it generally will parse all the files in a directory that contains the source file unless you add C_Cpp.files.exclude and change the C_Cpp.exclusionPolicy.