Castalia’s block highlighting doesn’t treat blocks nice if the indentation doesn’t follow the standard alignments. Very annoying for us that have different habits.
It could have worked if it didn’t insist on starting at the position of the begin/try, but rather on the first non whitespace at the line that contains the begin or try.
29 thoughts on “Castalia’s block highlighting doesn’t treat blocks nice if the indentation doesn’t follow the standard alignments.”
I believe that there is a setting that will make it work as you like. Sorry I don’t know what it is.
I just disabled Castalia completely. This issue and the flickery editor are too much for me.
I have put some thought into writing a much different block highlighting tool. The only reason I haven’t is that CnPack has one (very similar to Castalia’s) already and I try to write things that are new.
Nick Hodges There is an option “Structural highlighting mark hanging block, which removes the vertical line between the start and end of block, and only highlights the start and end points separately – which helps a little. Still, this doesn’t give the same clarity as a solid line. Add the flicker, and it looks like also this Castalia will be short lived in my IDE.
I know you hate to hear this, but I haven’t had a single problem with Castalia — I’m quite pleased.
Of course, I format my code the right way.
I persuaded my previous employer to get a universal subscription to Castalia. It’s generally been an excellent tool. I’m glad for Jacob that it’s been bought by Embarcadero, even though I know that it means — like AnyDAC before it — the end of support for previous Delphi versions.
Nick Hodges There isn’t any such setting (http://stackoverflow.com/questions/29517139/how-can-i-configure-the-new-delphi-xe8-editor-begin-end-visual-cues)
The hanging indent issue is the result of a few users insisting to change the older Castalia behavior (to handle different scenarios, of course). I guess at times it is better not to listen… 😉
Likely going to be reverted. Overall, Castalia has some great features, as it gets more integrated, the hiccups it can have today (not that I’m personally seeing many) will go away.
Marco Cantù One should always “listen”, but then one needs to take the “right” decision! 😉
Sure, this is what I meant. Listening is rarely bad, but when you start listening to many people all agreeing, you might be tempted to just think they are right… without taking into consideration all of the “other” scenarios. And this happens because people who disagree with the implementation of a feature tend to me more vocal than those who think the features is working fine.
+Marco Is Castalia going to be integrated from the “inside”, or will it remain external, as a plugin. ISTM that the former is very much more preferable.
IMHO, “creative” code styles work against readability. Worse, in a shop environment of more than 2-3 developers, they give rise to arguments, and can result in higher errors. My firm belief is that code should all be formatted to “Delphi standard” form before check-in. I will go get popcorn, as the screaming commences.
Bill Meyer There is no single standard. There’s no need for one either. In my house the use of single statement is banned. Only compound statement allowed. And we place the begin on the same line as the if. Hence Castalia is no good for us.
Castalia is good for Python.
David Heffernan There is a default standard, in the Delphi formatter. There is also a very similar default in the experimental formatter for GExperts. But I will contend, from decades of experience, and much too much experience with legacy code, that most of the “improved” styles play a part in masking flow, as well as defects.
Any coding style is better than none. I am not sure if some coding styles are better than others. For myself, I prefer the Delphi coding style just for two reasons: 1) I don’t have to switch when reading the Delphi sources. 2) The code emitted from MMX fits it pretty well.
On the other hand we have the code formatter which is configurable to a certain degree. Perhaps we will have a similar option with Castalia in the future.
Uwe Raabe Any? No. As the saying goes, any fool can write code a computer can understand. I’ve seen too much of that.
Bill Meyer Our style means that we never make the classic mistake with single vs compound blocks.
You think we should reformat 800k lines of code? I know I don’t think that’s a good idea.
Plenty of other tools can highlight blocks in a manner that is flexible to cope with varying styles.
It seems to me that it is easy for people who follow one particular “standard” to assert that everybody else should do the exact same as them. If you had adopted a different standard, that worked perfectly well for you, would you feel it wise to change for something that offered no advantages?
CNPack does structural highlighting correctly with various formatting styles. Castalia was always something I wanted to like, and I tried new versions every so often. However I found that by the time I turned off all the features duplicated by MMX, GExperts and CNPack, it just didn’t do enough to justify keeping it.
Kevin Powick I had a similar experience with Castalia. I came to it years ago, from CodeRush — oddly named, as it all but crippled the CPU — and was initially a fan. Then it expanded in directions I did not find that useful, and increased in price. I turned away at that point. CnPack, GExperts and MMX are a great combination. I’ve used MMX for years, and Castalia doesn’t fully replace it. Castalia also doesn’t eliminate the need for CnPack, nor for GExperts. Makes it an odd feature.
My rule with code formatting is “it must be mechanically applied”. I don’t especially care what the standard is as long as there’s a program that can apply the standard automatically.
I have worked with some awful formatting standards over the years, and the only really unbearable one was a manual system with no general rules, such that only a human could format code and even then there were arguments. Not only could be not auto-format the code, we couldn’t reliably diff it or read it as different people had subtly varying interpretations of things like the indentation of an else clause when the then had a begin-end but the else did not. DO NOT go there.
The other advantage, of course, is that I can mechanically format code correctly, then apply the workplace formatting before I commit code.
Marco, “likely going to be reverted”? The structural highlighting didn’t work well for all coding styles before the change either, so wouldn’t it make sense to improve the feature in general, instead of reverting from one poor implementation to another?
Nick Hodges “I know you hate to hear this, but I haven’t had a single problem with Castalia.”
Are you suggesting that the rest of us are imagining things? Or what are you suggesting? An important part of software development is the ability to see things from other user perspectives.
Perhaps he is just offering us his perspective.
Lars Fosdal I don’t really understand such comments then.
Person A: “When I do X, I have a problem.”
Person B: “When I do Y, I don’t have a problem.”
Moz Le One of the things I like about Google’s Go language is that the designers set the code formatting style/rules and included a utility to do it within the tool chain (gofmt). It is very rare to come across someone’s Go code and it not be formatted as per the spec. And if you do find code with a strange format, you just run gofmt and all is well.
Kevin Powick yes, and Microsoft have done the same with C# (and I suspect the other languages in Visual Studio). Even when the official approach isn’t perfect it’s bearable just because it’s consistent.
Added https://quality.embarcadero.com/browse/RSP-10573 – hoping it will make the grade for the expected Castalia overhaul
David Heffernan The point of someone saying that he does not have a specific behavior is to show that said behavior does not happen 100% of the time which is an important information imo.
Lars Fosdal The “Structural highlighting mark hanging block” has changed with XE8. It used to align with the end and extend up to the line with the begin on it. Now it aligns with the begin, extending through the body of the code to the end line. This does not even guarantee that the structural lines order correctly right to left.
You must log in to post a comment.