Implement c_cpp_properties.json file generator fixes #1201#1205
Implement c_cpp_properties.json file generator fixes #1201#1205renkun-ken merged 12 commits intoREditorSupport:masterfrom
Conversation
|
Should be working as expected now. |
|
I came across this tweet which points to https://github.com/r-lib/usethis/blob/main/R/vscode.R, but it does not look like general enough. Not sure if it is helpful here. |
Thanks, this captures LinkingTo detectives from the DESCRIPTION and general R paths, but this PR also compiles dummy files to capture everything in configure and Makevars (defines, local includes, system dependencies, ...). I imagine the usethis script is meant to be edited manually later. (I'm not sure why the CI fails, it might be an unrelated issue) |
|
I tried it with latest httpgd on macOS, and the following file is produced (an empty {
"configurations": [
{
"name": "Mac",
"defines": [
"NDEBUG",
"BOOST_NO_AUTO_PTR",
"FMT_HEADER_ONLY"
],
"includePath": [
"${workspaceFolder}/src",
"/Library/Frameworks/R.framework/Versions/4.2/Resources/include",
"${workspaceFolder}/src/lib",
"/usr/local/include",
""
],
"compilerPath": "/usr/bin/clang++",
"cStandard": "${default}",
"cppStandard": "gnu++14",
"intelliSenseMode": "macos-clang-x64"
}
],
"version": 4
}with the following error: |
This is a bug, even when no C/C++ is used, the action should generate a config as you should be able to run it prior to adding C/C++ files. Can you try again? I don't get this error but have added stricter null checks everywhere (7d4ade3). A bit off-topic but what's the consensus on tsconfig.json |
renkun-ken
left a comment
There was a problem hiding this comment.
I tried it with httpgd, languageserver, and RMariaDB and all work nicely!
LGTM
Thanks for the nice work!
|
Thank you for your comments and the review! |


What problem did you solve?
This PR implements a command "Generate c_cpp_properties.json" that generates the file by collecting information from invoking the compiler and from the DESCRIPTION file.
This enables code completion, IntelliSense, etc. for C/C++ files in R packages.
The issue is described in more detail here: #1201
Demo
Code_rcwvV3zBYQ.mp4
TODO