-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for partial/fragment compile_commands.json
files, such as generated by the clang -MJ option
#12837
Comments
Hi @akhodeir . The error message you may be referring to ( Looking at the code, it looks like that error could specifically refer to:
You might try pasting the file into an online JSON validation form. If the JSON file is well formed, could you provide a (trimmed down) example that reproduces the issue? |
Note: The compile_commands.json is working perfectly on clangd extension. it is also parsed correctly on VSCode. update: sorry for closing the issue and re-opening it. just a mistake. |
Hi @akhodeir . It looks like the "-MJ" command will generate a We can add support for this format, but I'd suggest opening a bug against the LLVM project suggesting they either output a conformant file or update their own documentation to indicate that file format supports either the existence or non-existence of the array root node (and clarify their divergence from the JSON format in a '.json' file). |
compile_commands.json
files, such as generated by the clang -MJ option
I added prackets "[" and "]" around the content of compile_commands.json and the error didn't appear again ! does this mean that cpp extions needs to add implicitly brackets around the content of the compile_commands.json ? one more thing, is there anyway exclude those files from being parsed:
I don't see any value from parsing 12117 files which are not part of my code. I never saw clangd doing this. it just parse what is in compile_commands.json or none. is there anywere to stop parsing un-necessary files? |
Hi @akhodeir . Frameworks would be returned by clang when queried as part of your 'base configuration'. The configuration in your |
@akhodeir The logging says it just discovered 12117 files -- all those files are not necessarily parsed. If you do see files that are parsed, you can add the folders that contain the files to |
I checked the pre-released version and the fix works well for one file. Please check this : https://github.com/akhodeir/CPP/tree/main/05_Constructor_Initialization The generated compile_commands.json is as follows
|
Hi @akhodeir . I'm unable to reproduce this issue, in 1.23.2. The nature of the fix for this issue was to make the outer array brackets optional. There shouldn't have been any other changes in the behavior of the feature. With a simple example, I'm seeing that multiple entries in a In your example above, I see that both the https://clang.llvm.org/docs/JSONCompilationDatabase.html If you're still seeing a problem, could you provide a stand-alone example that we might investigate directly, in the form of a zip file or GitHub repo? |
Environment
About VSCode:
Bug Summary and Steps to Reproduce
Bug Summary:
I always use clangd(llvm-vs-code-extensions.vscode-clangd) extension for my work since it can parse the compile_commands.json and is really fast.
I got to know that microsoft extensions can also use compile_commands.json so I gave it a try.
Steps to reproduce:
Expected behavior:
C/C++ extensions shall parse the compile_commands.json.
C/C++ extensions shall not parse the compiler,java, and SDK
Configuration and Logs
Proj1/main.cpp
c_cpp_properties.json:
tasks.josn:
C/C++: Log Diagnostics:
Other Extensions
ms-vscode.cpptools
ms-vscode.cpptools-extension-pack
ms-vscode.cpptools-themes
Additional context
No response
The text was updated successfully, but these errors were encountered: