3 ms·
This 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 referenc
by unfamiliar 12y ago
This 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
- jokoon 12y agoSyntax highlighting is a complex problem, because it needs to be fast enough, and the more token types you have, the longer it takes. Each time you type a character, you have to parse the code (clang is used here), select the according color, and draw the text (often the OS will deal with this, and I don't know if you can tell an OS to just update one line of drawn code). This is a vim plugin, and it's way easier to colorize text in a console environment than in a cross platform GUI window (not to mention UI text editors use a dedicated data structure, the rope: http://en.wikipedia.org/wiki/Rope_%28data_structure%29 http://en.wikipedia.org/wiki/Rope_%28data_structure%29 to make text editing responsive when using the mouse). My guess is that sublime text completely shortcuts this problem by using webkit to draw its own text surface. Anyway, it's another example of how competing windowing systems are inflexible and make things harder on the programmers, which often overcome the problem by avoiding the OS. Cross platform software programming is more than a philosophy or an art, it's a war against OS manufacturers. It's won by finding the easiest solution to make it work on all platforms. In this case, you can clearly understand how making an editor with syntax highlighting requires many different things, so editing the colors and adding a language will greatly improve complexity. My take is that one day someone will have the decency to just release an OS that just offer developers to use the hardware directly (or something like cairo) to draw even a simple window, without anything like Xorg, android, wayland, gnome, KDE, etc. The cost of coding something to display the results of your software is way too high when you want to do it the "mainstream way". I'm a little angry at Torvalds, not having tried to introduce something to build simpler GUI stuff. So, in short, don't expect it to work on sublime text if the dev don't get involved. I guess it's possible since sublime text support scripting, but I wonder if it's possible to do it with decent performance. Even Sublime text start to hang a little when you have a large html file. I was once very frustrated with text editors (always some missing feature, and I never accepted to switch to vim or emacs), so I tried to make my own, and I failed miserably and settled for what is already there. I still wonder if I can be more productive with vim, but if it becomes necessary to use it because a 11" laptop can't run an IDE, maybe I'll do the switch.
- akavel 12y agoUh? Some points you mention seem to have some sense, but: * rope - do you actually know of any editors using it? I'd love to hear about them, especially if open-source, so that I could try exploring the sources, and maybe contribute/fork. I know MS Word does (did?), and ABIWord does (albeit with perf issues). Especially among the "programmer editors", AFAIK, most settle on "line gap" model, or other similar simpler ones; * easier to colorize text in a console env than a GUI??? wtf? I suppose it's rather opposite, if different at all; in GUI, if you can render text, you can usually render it in any color you like; * sublimetext using webkit??? wtf again? is your guess in any way educated, as for me it sounds like a totally random shoot in the dark; from quick googling, https://www.sublimetext.com/forum/viewtopic.php?f=2&t=7416 https://www.sublimetext.com/forum/viewtopic.php?f=2&t=7416 doesn't seem so, at least for ST2.
- bjustin 12y agoSublimeClang [0] does syntax highlighting and even code completion in Sublime Text. I used it for Objective-C sometimes when I'd get annoyed with Xcode. The author has since started another project that will hopefully avoid some of its problems, but last time I checked, it still worked OK. [0] https://github.com/quarnster/SublimeClang https://github.com/quarnster/SublimeClang
- unfamiliar 12y agoIs this true? I use SublimeClang and afaik it doesn't do syntax highlighting.