xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
10.05k stars 786 forks source link

compile_commands and precompiled headers #3173

Closed murshex closed 1 year ago

murshex commented 1 year ago

Xmake Version

2.7.3

Operating System Version and Architecture

All

Describe Bug

image

I noticed these two lines in "plugins/project/clang/compile_commands.lua".

After removing these lines, vscode intellisense is working again for precompiled headers.

Is there any reason that precompiled headers are disabled for compile_commands?

Expected Behavior

working vscode intellisense

Project Configuration

No response

Additional Information and Error Logs

No response

murshex commented 1 year ago

After commenting these two lines, intellisense works in all source files, but intellisense still has problems in the pch file.

image

If I manually add the pch file to the compile_commands.json like this, intellisense in the pch file works correctly.

waruqi commented 1 year ago

I disabled it because I didn't have time before to test if it worked on all compilers and LSPs.

I think even with pch disabled, it should fallback to using the -Ixxx to find headers if you include pre-compiled headers in the source code. It should also work.

murshex commented 1 year ago

Okay thanks… I’ll do that!