Looking for a c/c++ completer


#1

Hello,

I am looking for a good c/c++ autocompleter. I have tried:

  • autocomplete-clang: it also suggest private methods/properties
  • atom-clang: never could make it work / specify the flags and it doesn’t seem to be standalone (it needs project-manager)
  • atom-ctags: the project seems abandoned and I never could complete anything

Thank you very much in advance.


#2

I’ve been using the atom-ide with the cquery LSP package.

You need to generate a compile_commands.json file for your project. You can do that with CMake or bear if you’re using gcc


#3

Wow,

Thank you VERY MUCH for this great package, although it still seems a bit young.

P.S: a package using compile_commands.json is perfect


#4

I tried it and unfortunately, unless you have a solution, I noticed that it didn’t complete well namespaces nor constructors.

But thank you again anyway.


#5

I use boost and standard library and my own namespaces. It works fine.

I haven’t paid attenttion to constructors so I’ll watch for that.


#6

When I type <namespace>:: the underlying namespace or class doesn’t automatically show up. I have to start typing it to have a suggestion.


#7

For example, I have fs aliased to std::experimental::filesystem

when I type fs:: the next character after the :: starts suggested completions showing.

I think there is a setting for auto-completion to specify how many characters to type before you see suggestions. I believe the default is 3.


#8

Wow, you are a genius :smiley: :+1:
Thank you very much :slight_smile:

I don’t know if you can help me, but do you know how to limit the number of suggestions ?

I tried to set it in cquery and autocomplete-plus but when I scroll down it continues showing up suggestions.


#9

Thanks !

I don’t know how to limit the length of list. As you type, the list gets more specific and thus shorter.

don’t know if that helps


#10

I understand, thank you.

Unfortunately I also noticed that it also sometimes showed private members. I don’t know if you know how to limit the scope of the suggestions.

Anyway thank you very much for all your precious help :smiley: :+1:


#11

I use nuclide it’s a huge package but it’s the best autocomplete I found.
It uses libclang and need some config but it’s worth trying.


#12

Thank you very much for your help.

The only problem, if I’m not mistaken, is the license. If I understood it well (english is not my mother tongue) everything developed with the help of this tool is owned by facebook.

Am I correct ?

Thank you very much in advance.


#13

I’m not a lawyer, but the license says Nuclide itself is owned by Facebook, not the software you make using it.


#14

Thank you very much. I think I’ll then use it, it seems fantastic.


#15

Hello,

I’ve been trying to use Nuclide, but unfortunately, it doesn’t seem to work for completion/linter. I have a .compile_commands.json located at the root of my project (generated from cmake).

Could you please tell me how you managed to have it working ?

Thank you very much in advance.


#16

Did you configure your libclang path in the nuclide config?
I only could get it working with libclang-3.8
If you set the lldb python helpers the debugger works too but doesn’t set the breakpoints, you can set the breakpoints in the terminal and the debugger recognizes.

ps: As I had a lot of problems with nuclide conf so I changed to vscode, it’s very inferior but at least consistent.


#17

Thank you.

I tried. But my version is clang 6.0. I don’t know if it changes anything. There is also the clang 3.8 package. I don’t know if it by installing this package it might change anything. But I tried to installed and it compiles the llvm libraries and it takes ages.

I also set the path to my libclang.so (/usr/lib) in nuclide but it doesn’t seem to change anything.

Thank you very much in advance for all your help.


#18

You can install both version with no issue but… it might change your default clang and etc, so check clang version on the terminal for sure.

set you path to the specific version, somethig like: /usr/lib/llvm-3.8/lib/libclang.so.1

And restart your atom.


#19

Thank you for your precious help.

I’m building the llvm libs since it doesn’t seem I have the /usr/lib/llvm-3.* directory. My libclang.so is situated the root of /usr/lib. So maybe it’s a different library, or you have a different distribution. I think it’s gonna take about half an hour to build. I haven’t found any prebuilt binaries.

Thank you again for your help.


#20

I use Ubuntu, what’s your distro?

my /usr/lib/libclang.so is a link to another folder.