Skip to content
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

LSP Zero auto import C++ (clangd) #68

Closed
toziegler opened this issue Dec 15, 2022 · 2 comments
Closed

LSP Zero auto import C++ (clangd) #68

toziegler opened this issue Dec 15, 2022 · 2 comments

Comments

@toziegler
Copy link

Hi,
thanks for the great tool.

I switched from nvim-lspconfig to LSP-zero and so far, everything works great.
Although there is one missing functionality for me: auto include of dependencies for C++ from the standard library.

For instance, if we create a new empty main.cpp:

int main (int argc, char *argv[])
{
   std::vec  // no include (#include <vector>) and autocompletion for std::vector 
   return 0;
}

Previously with nvim-lspconfig, there has been a suggestion to auto-complete std::vector, triggering the necessary include.
From my understanding, the cmp documentation mentions that this should be possible when the capabilities are set accordingly, which should be the default.
Unfortunately, this does not seem to have any effect.

I used the default config, as shown in your Readme.

Thanks so much

@VonHeikemen
Copy link
Owner

do you have compile_commands.json in the root of your project?

@toziegler
Copy link
Author

Actually, no for this single cpp file I haven't. I thought I would be possible to let clang suggest system includes. But I will look deeper into clangd. Thanks though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants