Handmade Network»Forums
Marc Costa
64 posts
YouCompleteMe - Vim Completion Engine
I found the information in this page: vimcasts.org very useful for some advanced usage scenarions. I haven't read the book, so I can't comment on that.
3 posts
YouCompleteMe - Vim Completion Engine
It's pretty laggy though if you try to backspace a letter
Chen
102 posts / 2 projects
Some guy trying to make some video game.
YouCompleteMe - Vim Completion Engine
YCM is a pretty sweet engine, but how am I going to configure it if I'm doing unity build (the way handmade hero builds)? It seems to me that it treats every .cpp file as a separate compilation unit so it just breaks when I try to do unity build.
Mārtiņš Možeiko
2237 posts / 1 project
YouCompleteMe - Vim Completion Engine
Don't name them with .cpp extension? Maybe "file.impl.h" or just "file.inl" so it will treat them as headers.
Timothy Wright
76 posts / 1 project
YouCompleteMe - Vim Completion Engine
Chen96
YCM is a pretty sweet engine, but how am I going to configure it if I'm doing unity build (the way handmade hero builds)? It seems to me that it treats every .cpp file as a separate compilation unit so it just breaks when I try to do unity build.


I have the same problem developing stb headers. When you are in the header, the #define IMPLEMENTATION isn't defined, so it doesn't parse this code.

It's a little janky, but I just make a define like this:

1
2
3
#if defined(STB_IMPLEMENTATION) || defined(YCM_DEV)
// code here
#endif


Then I just add a
'-DYCM_DEV',
to the .ycm_extra_conf.py

You can also do this same thing and just add whatever includes you need
so ycm will find them but the unity build won't.

1
2
3
4
5
#ifdef YCM_DEV
#include <stdio.h>
#include "thing.cpp"
// whatever else you need
#endif


It is kinda Janky but I haven't found a better way.
Chen
102 posts / 2 projects
Some guy trying to make some video game.
YouCompleteMe - Vim Completion Engine
Edited by Chen on Reason: Needed to put more information
Oh yeah, didn't think about that! That's a pretty hacked way but it should work just fine. However if I include multiple ini files (treated as headers now) in a cpp file, wouldn't ycm ignore the fact that preceding files will be invisible to the later included ini files?

One question post on stackoverflow that's similar:

http://stackoverflow.com/question...438211/youcompleteme-header-files

In the example that is shown in the post, content that's in a.h is not visible to b.h, but in the cpp file a.h is included before b.h file is included. What's the workaround so that ycm will understand the entire content of a.h should be visible to b.h?
Mārtiņš Možeiko
2237 posts / 1 project
YouCompleteMe - Vim Completion Engine
You should structure the included "cpp" files (.inl or whatever) in a way that they are independent. That means have them #include in the beginning other .h files they depend on.

If you just have .h files without any .cpp and are depending on this implicit dependency then there's nothing you can do...
Chen
102 posts / 2 projects
Some guy trying to make some video game.
YouCompleteMe - Vim Completion Engine
I see. That was pretty helpful, thanks!