6 ms·
Color_coded: Real-time semantic highlighting in vim with libclang
- fourier 12y agoWill be great to have something like this in Emacs.
- Jeaye 12y agoAfter looking, I'm astonished that this doesn't exist in Emacs. There is a completion plugin using libclang; maybe the highlighting could just be added into it. On vim's side, YouCompleteMe explicitly denied my approach to integrate highlighting.
- captainmuon 12y agoI hacked together something to add at least #ifdef highlighting* to YouCompleteMe. It's not quite ready to share due to some bugs, but I'm planning to release it as a patch / friendly fork when I find some time. I believe there's no reason to have two plugins each running an instance of clang. * i.e. showing parts of code that are ifdef'ed out in grey
- lsiebert 12y agoit would be nice if it could hook into YCM's config file instead of needing a separate one, when available.
- Jeaye 12y agoYeah, that's something I considered from the start. The issue is that, in order for that to work reliably, color_coded would basically need an embedded Python interpreter. YCM's config file can contain arbitrary python functions and doesn't really need to follow any standards. This makes it hard on color_coded and ultimately didn't seem worth the trouble.
- 616c 12y agoUh, what? http://truongtx.me/2013/03/10/emacs-setting-up-perfect-environment-for-cc-programming/ http://truongtx.me/2013/03/10/emacs-setting-up-perfect-envir...
- Jeaye 12y agoI don't see real-time semantic highlighting using an embedded compiler there. Maybe I missed it.
- 616c 12y agoMy bad, I assumed it included highlighting, but it appears it is just auto-complete from Clang. https://github.com/brianjcj/auto-complete-clang https://github.com/brianjcj/auto-complete-clang That being said, if the core infrastructure is there, the hard part (Clang backend) is there, how much more can semantic highlighting be? (I duck because I write amateurish code and do not do C/C++ yet, but would hopefully learn to do something awesome like that one day.)
- davidshepherd7 12y agoHave you got a plain text version of the highlighted source examples somewhere? I want to compare it with emacs' default highlighting (I think default emacs highlights almost as much as the "After color_coded" screen shot).
- Jeaye 12y agoThe first picture is from the color_coded source itself: https://github.com/jeaye/color_coded/blob/master/include/async/queue.hpp#L30 https://github.com/jeaye/color_coded/blob/master/include/asy... The second picture is from my C++14 JSON library: https://github.com/jeaye/jeayeson/blob/master/include/jeayeson/value.hpp#L69 https://github.com/jeaye/jeayeson/blob/master/include/jeayes...
- davidshepherd7 12y agoThanks, for anyone curious here's what emacs does with the first example: http://imgur.com/Rddi9QH http://imgur.com/Rddi9QH compare with color_coded: https://camo.githubusercontent.com/5cf719c6357f27b86c45bf9b5461686c70e322ef/687474703a2f2f6a656179652e636f6d2f63632f7472696d6d65645f63635f745f7965735f332e706e67 https://camo.githubusercontent.com/5cf719c6357f27b86c45bf9b5... So it looks like color_coded can highlight at least a few things that default emacs doesn't: function calls, variables (when they are used, both can highlight declarations) and non-standard type template parameters.
- bowlofstew 12y agoThat is awesome. I am going to give that a shot today.
- unfamiliar 12y agoThis is one thing I would love to see in sublime text. Isn't the name a bit vague though? "color_coded" could refer to anything, surely something that references clang directly would be more appropriate?
- Jeaye 12y agoThe way I see it, clang is an implementation detail; this might be implemented with something else, if only anything better existed. If anything, it should reference vim. Alas, I'm a sucker for wordplay. It can be pointed out that YouCompleteMe, for example, also doesn't have vim in the name. I guess it's not so bad!
- unfamiliar 12y agoI've always thought YouCompleteMe was a stupid name too. I guess I'm just no fun :/ I don't think clang is an implementation detail. Surely the custom syntax highlighting engine is a vim feature. It's the "using clang" that makes this interesting.
- Jeaye 12y agoThe point is that this project is impossible without embedding an compiler. Vim's syntax capabilities alone are based on matching; they don't actually compile the code. The benefit provided by color_coded is that the highlighting is based on how your code looks to the compiler, not to a (very clever) regex machine. Given that, the fact that I chose libclang doesn't change the functionality of the project.
- towelguy 12y agoMaybe it should be renamed to YouColorMe
- Jeaye 12y agoI considered this! The reason I didn't choose it was that both would be called YCM. That'd be messy.
- adrusi 12y agoDoesn't seem to work in neovim currently, as lua support is being completely changed.
- Jeaye 12y agoRight. This hasn't been tested in neovim at all. I can add that to the readme to save people some time.
- en4bz 12y agoReally wish projects like this and YCM would stop including most of Boost and provide an option to use the installed system version instead.
- Jeaye 12y agoWith the annoying number of systems that don't have boost installed, such projects are forced to accommodate (by shipping with their own). After the accommodations are made, there's little reason to allow for the usage of the system's boost. Similarly, color_coded downloads its own clang. Why? 1) People may not have clang installed (like boost) 2) (more importantly) color_coded is tested and proven to work with a specific version; it's more portable this way If we suddenly allow users to use system-level boost and clang and foobar implementations instead of that which we ship, we're also opening a can of worms for incompatibilities. The amount of coverage that needs to be tested grows surprisingly quickly.
- deleted 12y ago[deleted]
- farresito 12y agoThank you for your work on this! I will surely give it a try.
- gcb0 12y agosigh. yet another plugin that uses more files then a simple plugins/x.vim that has no manual installation instructions.
- slashnull 12y agoIf you read the fine print and use Pathogen, you can just clone and make in .vim/bundle/color_coded and it will work.
- Jeaye 12y agoDid you look at the 200 line readme, specifically the part labeled "Installation"?
- gcb0 12y agoyes i did. the 'generic' install is using pathogen or vundle.
- slashnull 12y agoIsn't that like HDevTools for C++? Neat.
- hboon 12y agoOn the off chance that Jeaye is still reading. How do i get it to work with Objective C? I tried: -x objective-c Nothing for CCerror. `make run` with the .cpp sample works.