0

I am looking for a good alternative ide for c++ and for that started to lern first vanilla emacs and now spacemacs. I have configured my .spacemacs now to be able to edit lisp code quite comfortably using company-mode.

The most important feature for me is that the function documentation of the candidates is shown in a help popup automatically as I was used to from "Netbeans" in java.

Today I have started to work on a c++ project using the c-c++ layer and company-clang. I have managed to get it running so that I get code completion of my c++ functions as well as my snippets, though the header completion seems to only finding the old c headers like "string.h" and not "string".

However I don't receive any help popup during completion. Did I do anything wrong or is this simply not supported by the layer? And more importantly is there an alternative layer/plugin available to get that working?

If anybody has a hint for the string header file issue I would also be happy to hear about it.

2

Spacemacs provides a help popup during completion through company-quickhelp, but you need to explicitly enable it, as described in the documentation for auto-completion layer. What you need to do is set the layer variable auto-completion-enable-help-tooltip to t. There are two good ways to change it.

The first way is to set the variable in the same place where you enable the auto-completion layer. In the dotspacemacs-configuration-layers list, replace:

auto-completion

With:

(auto-completion :variables auto-completion-enable-help-tooltip t)

The second way is to set the variable in dotspacemacs/user-init:

(defun dotspacemacs/user-init ()
  ;; ...
  (setq auto-completion-enable-help-tooltip t))
1

Its a long time since I asked that question, and I have found an answer by myself now. For others I would like to post my findings here:

Basically there are two different implementations of source code completion frameworks in spacemacs right now, one is company the other is ycmd.

As to now company-clang does not support doc-strings for C++ code out of performance reasons. Ycmd does support them however I found them quite lacking, i.e. I did not receive doc-strings for system headers.

More importantly ycmd did not integrate nicely into the C++ layer for example it did not share the path to the C++ system headers with company-header causing it to only show C headers.

Therefore I have changed back to company now. Doc-strings are only shown for elisp and shell-script mode however I am not longer that dependent on it. I am now quite used to just searching the web when I am not sure what a certain function does or I just jump to the function definition and have a look for myself.

Some words to the spacemacs beginner, as I have written this post I was not yet sure whether spacemacs would be able to be a real substitute for my good old graphical IDE. Now after some month of actually working with it I have to say that spacemacs really exceeded my expectations, it did not only prove that it could provide me with the same tools as Netbeans. It did also exceed it more than once and has not stopped yet to surprise me, which is a good thing. So if you also look for a better tool than the usual Eclipse or Netbeans I would suggest to have a look at spacemacs.

0

c-eldoc-mode might help a bit. I am not sure why spacemacs doesn't include it in the c-c++ layer. I submitted a feature request for this so maybe they will in the future.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.