You are not logged in.

#1 2010-10-04 23:56:51

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

C++ completion in vim with gccsense (completing from gcc)

Has anyone tried gccsense? It's been around for a few months.

http://cx4a.org/software/gccsense/

I thought I would find a package in AUR, but actually, no. Any volonteer?

Offline

#2 2010-10-05 00:58:39

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,358

Re: C++ completion in vim with gccsense (completing from gcc)

Why not try to make a PKGBUILD yourself?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2010-10-05 06:46:28

cebru
Member
Registered: 2009-06-17
Posts: 39

Re: C++ completion in vim with gccsense (completing from gcc)

That looks very interesting.

Offline

#4 2010-10-05 07:43:48

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: C++ completion in vim with gccsense (completing from gcc)

ngoonee wrote:

Why not try to make a PKGBUILD yourself?

Correct.

Well, I'm not doing C++ right now. If I need to, I may. I'm just posting this here in case somebody else finds this interesting and wants to do it before me.

Offline

#5 2010-10-05 11:07:51

schuay
Package Maintainer (PM)
From: Austria
Registered: 2008-08-19
Posts: 564

Re: C++ completion in vim with gccsense (completing from gcc)

Looks cool, but requires a whole custom compiled gcc (available on their site as gcc-code-assist).

Offline

#6 2010-10-20 00:36:35

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: C++ completion in vim with gccsense (completing from gcc)

FYI I made PKGBUILDS. As it is built on gcc, I had to mess up with directories. If you have improvements to submit, they are on https://bitbucket.org/chmduquesne/archlinux-packages

Offline

#7 2010-10-20 12:51:35

gbarnett
Member
Registered: 2010-09-28
Posts: 7

Re: C++ completion in vim with gccsense (completing from gcc)

I've seen this before and while it seems like a really cool idea it does has some serious downsides which were pointed out in the GCC mailing list when the developer originally floated this idea to the community, the biggest of which being that this is a separate GCC and so it would be hard to maintain with the mainline GCC, also its a little fiddily to actually use.

If you really need completion then you would be safer to go with gtags (for Vim, I haven't used Vim for ages though), CEDET (in conjunction with cscope or global) for Emacs, or *shudder* the CDT for Eclipse (the big downside here being that you need to fit everthing into an Eclipse project model and that you are using Java).

Offline

#8 2010-10-20 16:34:20

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: C++ completion in vim with gccsense (completing from gcc)

gbarnett wrote:

I've seen this before and while it seems like a really cool idea it does has some serious downsides which were pointed out in the GCC mailing list when the developer originally floated this idea to the community, the biggest of which being that this is a separate GCC and so it would be hard to maintain with the mainline GCC, also its a little fiddily to actually use.

Obviously, the maintainability may not be the best quality of this program. Well, anyway when it comes to C++, do not expect something simple.

gbarnett wrote:

If you really need completion then you would be safer to go with gtags (for Vim, I haven't used Vim for ages though), CEDET (in conjunction with cscope or global) for Emacs

None of the tools you mentionned were designed to be used with C++. They may be fine if you use if you try to complete C, but for C++ the completion will work horrible. For example, vim's omnicppcomplete is indentation-style sensitive, so either you adapt your style to get the completion to work fine (and you ask your colleagues to do the same - pretty much unfeasible), either you get something that works half of the time.

I don't think the guy had such a terrible idea: after all, the compiler is in the best program to know how to resolve types: that's its job. They are also planning such features in clang++. And anyway, the C++ language is so bloated that using informations directly from the compiler is pretty much the only way to get accurate results...

gbarnett wrote:

or *shudder* the CDT for Eclipse (the big downside here being that you need to fit everthing into an Eclipse project model and that you are using Java).

Don't even mention it smile

Offline

#9 2010-10-20 17:17:26

Rip-Rip
Member
Registered: 2008-11-09
Posts: 32

Re: C++ completion in vim with gccsense (completing from gcc)

If someone is interested, I'm doing a vim plugin which use clang (and clang++ for C++) for completion. It's not finished but it's working well. Ask me if you want to test it smile

Note: you don't need any patched clang for my plugin

Offline

#10 2010-10-20 17:27:45

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: C++ completion in vim with gccsense (completing from gcc)

I am interested and I could even contribute (I've already messed up with writing omnicompletion functions for fun). Can I see the code?

Offline

#11 2010-10-20 19:43:22

Rip-Rip
Member
Registered: 2008-11-09
Posts: 32

Re: C++ completion in vim with gccsense (completing from gcc)

Of course, you can find it here: http://dl.dropbox.com/u/3309866/clang_complete.vim
Put it on ~/.vim/plugin/
And don't forget to delete omnicppcomplete because it's conflicting with mine smile. Completion is done by <C-X><C-U>

Offline

#12 2010-10-23 13:30:55

0ld
Member
Registered: 2010-04-16
Posts: 4

Re: C++ completion in vim with gccsense (completing from gcc)

Rip-Rip, thank you. That is great.

Offline

#13 2010-10-27 19:08:39

Rip-Rip
Member
Registered: 2008-11-09
Posts: 32

Re: C++ completion in vim with gccsense (completing from gcc)

Latest version of my plugin can be found there: http://github.com/Rip-Rip/clang_complete.

Offline

#14 2010-10-27 19:11:18

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: C++ completion in vim with gccsense (completing from gcc)

Please upload it on vim.org!

Offline

#15 2010-10-27 20:33:02

Rip-Rip
Member
Registered: 2008-11-09
Posts: 32

Re: C++ completion in vim with gccsense (completing from gcc)

Offline

#16 2010-10-28 10:27:39

davvil
Member
Registered: 2008-05-06
Posts: 165

Re: C++ completion in vim with gccsense (completing from gcc)

clang_complete works great!

I have however two comments:

1. You use mktemp, which at least from my experience is a pain for portability. On Arch it works flawless, but e.g. on an Ubuntu 8.04 system (what I have at work), the options you use are not supported. Could this be done inside vim, without resorting to mktemp?

2. This one is more a clang++ issue: The unordererd_sets and _maps (fancy names for hash tables) header files make clang++ to fail due to variadic templates not (yet) being supported. The completions, however, are right. I disabled the check for v:shell_error in order to get them in vim, but this is of course an ugly hack. Do you have a better temporary solution or should we just wait that clang++ supports these templates?

Offline

#17 2010-10-28 18:27:30

Rip-Rip
Member
Registered: 2008-11-09
Posts: 32

Re: C++ completion in vim with gccsense (completing from gcc)

davvil wrote:

clang_complete works great!

I have however two comments:

1. You use mktemp, which at least from my experience is a pain for portability. On Arch it works flawless, but e.g. on an Ubuntu 8.04 system (what I have at work), the options you use are not supported. Could this be done inside vim, without resorting to mktemp?

I didn't know that issue. I will try to suppress mktemp in a future version (I'm currently working on it).

Edit: I've just commited to github. I've drop the system("cat") and the system("mktemp") from the plugin.

davvil wrote:

2. This one is more a clang++ issue: The unordererd_sets and _maps (fancy names for hash tables) header files make clang++ to fail due to variadic templates not (yet) being supported. The completions, however, are right. I disabled the check for v:shell_error in order to get them in vim, but this is of course an ugly hack. Do you have a better temporary solution or should we just wait that clang++ supports these templates?

As far as I know, c++0x in clang++ is not really working, so until it is, disabling the check for v:shell_error is imho the best solution, but I'll try to find a better and more reliable solution smile

Last edited by Rip-Rip (2010-10-28 19:19:27)

Offline

#18 2010-10-28 20:50:00

davvil
Member
Registered: 2008-05-06
Posts: 165

Re: C++ completion in vim with gccsense (completing from gcc)

Rip-Rip wrote:

Edit: I've just commited to github. I've drop the system("cat") and the system("mktemp") from the plugin.

Now it works unmodified on both systems, arch and ubuntu smile

Rip-Rip wrote:

As far as I know, c++0x in clang++ is not really working, so until it is, disabling the check for v:shell_error is imho the best solution, but I'll try to find a better and more reliable solution smile

I think some parts work, some not. For my code the current status is enough to provide accurate completions, as I do not use any of the fancy features. The main problem is with the libraries, I think.

Anyway, it is not worth it to spend too much effort thinking about sophisticated workarounds, as clang should support all features eventually.

Offline

#19 2010-10-29 17:48:23

Zeist
Arch Linux f@h Team Member
Registered: 2008-07-04
Posts: 532

Re: C++ completion in vim with gccsense (completing from gcc)

I've just started using this, so far it feels like the easiest setup of any completion plugin I've seen so far.

Not to mention that so far it hasn't broken like omnicppcomplete tends to do quite frequently for me.

(This meaning clang, not gccsense)

Last edited by Zeist (2010-10-29 18:06:29)


I haven't lost my mind; I have a tape back-up somewhere.
Twitter

Offline

Board footer

Powered by FluxBB