简体   繁体   English

如何为clang的C++20特性正确设置ccls?

[英]How to properly set up ccls for C++20 features of clang?

I am currently setting up nvim as my main editor and try to get autocompletion to work properly with C++20.我目前正在将 nvim 设置为我的主编辑器,并尝试让自动完成功能与 C++20 一起正常工作。 The cpp code below compiles fine with eg g++-11 -std=c++20 or even with clang (only right ranges library path need to be linked) but the ccls server throws an error on the range-based for loop.下面的 cpp 代码可以使用 g++-11 -std=c++20 或什至使用 clang(只需要链接正确的范围库路径)编译得很好,但是 ccl 服务器在基于范围的 for 循环中引发错误。

在此处输入图片说明

I configured the .ccls like that:我像这样配置了 .ccls:

在此处输入图片说明

the -ccc-install-dir just puts the new c++20 std lib in to locate ranges. -ccc-install-dir 只是将新的 c++20 std lib 放入定位范围。 And finally my coc-settings.json looks like this:最后我的 coc-settings.json 看起来像这样:

在此处输入图片说明

And I can't figure out why the completion doesn't work for features that clearly compile and eg in Xcode don't even throw an error but with ccls it doesn't work.而且我无法弄清楚为什么完成对清晰编译的功能不起作用,例如在 Xcode 中甚至不会抛出错误,但使用 ccl 它不起作用。

give a try to roshnivim , it works out of the box.试试roshnivim ,它开箱即用。 Everyone has theirs own taste of config and mappings so, you can change it here .每个人对配置和映射都有自己的品味,因此,您可以在此处进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM