microsoft / microsoft/vscode-makefile-tools
Use compile_commands.json as alternative input (for includes, defines, ...)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 242
- Forks
- 78
- PR merge metrics
- No merged PRs in 30d
Description
I have a simple linux kernel module which has a bunch of includes at the top, e.g.
#include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/cdev.h>
#include <linux/uaccess.h>
The Makefile is also straightforward, e.g.
obj-m += test_module.o
all:
make -C $(KERNEL_DIR) M=$(PWD) modules
clean:
make -C $(KERNEL_DIR) M=$(PWD) clean
KERNEL_DIR is an environment provide variable that points to the Linux kernel source code.
When I launch VSCode I can build the kernel module without any issues, but in the editor under three of the includes a red squiggly line is displayed and it complains that it cannot find the file. Under the other three it finds the system provided header files, rather than the correct ones in the KERNEL_DIR directory.
If I manually provide a c_cpp_properties.json file with the include paths and defines manually specified everything works fine, e.g.
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${env:KERNEL_DIR}/include",
"${env:KERNEL_DIR}/include/uapi",
"${env:KERNEL_DIR}/include/generated",
"${env:KERNEL_DIR}/include/generated/uapi",
"${env:KERNEL_DIR}/arch/x86/include",
"${env:KERNEL_DIR}/arch/x86/include/uapi",
"${env:KERNEL_DIR}/arch/x86/include/generated/",
"${env:KERNEL_DIR}/arch/x86/include/generated/uapi",
"/usr/lib/gcc/x86_64-redhat-linux/12/include"
],
"compilerArgs": ["-nostdinc", "-isystem"],
"browse": {
"path" : [
"${workspaceFolder}",
"${env:KERNEL_DIR}/include",
"${env:KERNEL_DIR}/mm",
"${env:KERNEL_DIR}/fs",
"${env:KERNEL_DIR}/kernel"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"defines": ["__KERNEL__", "MODULE"],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu11",
"cppStandard": "c++14",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}
However I had read that Makefile Tools was supposed to avoid needing to do this manually. Is that not the case?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Makefile Tools configuration-provider path and how it generates or consumes compile_commands.json; compare that with the c_cpp_properties.json example and the kernel module's include and define needs. Done means the extension can use compile_commands.json to supply IntelliSense inputs without manually duplicating the configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, vscode
- Domain
- developer-experience, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100