sublimelsp / LSP-clangd

C/C++ support for Sublime's LSP plugin provided through clangd.
MIT License
41 stars 1 forks source link

arbitrary file type selectors #32

Open PhilipDeegan opened 1 month ago

PhilipDeegan commented 1 month ago

Hi,

I'm trying to use this with the ROCM HIP/Thrust code base from AMD, but it seems to be having issues with sources like "ABC.inl"

I'm trying to configure a custom selector, but modifying the default to include source.inl | but I'm not sure it's enough

any tips would be appreciated

thanks

rwols commented 1 month ago

In-line include files are usually not compible as standalone compilation units. The design of clangd requires this, so it won’t work well with those type of files.

PhilipDeegan commented 1 month ago

it appears to propagate an issue to the my original source which includes it indirectly, is there someway to disregard errors in unrelated files, assuming I'm not using any symbols declared within?

rwols commented 1 month ago

What is the error you're seeing?

PhilipDeegan commented 1 month ago

I'm seeing a few, but I have a feeling that one is caused by the other other

Thrust from AMD has some optional CUDA compatibility, which I am not using, yet clangd LSP is saying it can't find some cuda related header (cub specifically). When I compile normally, I do not get such an error. It's quite possible I'm missing some defines in my .clangd file which the hipcc compiler expects.

The other error I'm seeing, which I don't really get, and it only appears in thrust headers, is cstddef header not found

but I can include it my own source and LSP shows me the correct gcc header

image

I don't really want to have LSP analyse .inl files, but are they still used as part of the AST for other files?

PhilipDeegan commented 1 month ago

Also, since I've switched from compile_flags.txt to .clangd

relative includes from the project root directory no longer work, as I'm guessing, the working directory is changing to the source file directory, when the relative imports are no from there, maybe this could be separate issue, or you have some idea to support relative includes from the root project directory (where .sublime.project... are)