Syntax highlighting
Apr. 25th, 2007 12:50 pmHow much syntax highlighting do you generally get when you edit code? Any?
Does it call out different variable types?
Can you easily configure it dynamically to eg. highlight different ifdef branches or variables with certain prefixes?
Should it be able to?
Does it call out different variable types?
Can you easily configure it dynamically to eg. highlight different ifdef branches or variables with certain prefixes?
Should it be able to?
no subject
Date: 2007-04-25 12:13 pm (UTC)When I did lots of python work, well, it's dynamically typed, so no type highlighting there.
I'm not convinced that type highlighting is universally useful, given dynamic typing, type heirarchies etc.
no subject
Date: 2007-04-25 12:28 pm (UTC)no subject
Date: 2007-04-25 12:50 pm (UTC)no subject
Date: 2007-04-25 01:05 pm (UTC)no subject
Date: 2007-04-25 01:06 pm (UTC)If you want visual cues for anything else, you have to rely on careful indentation and layout. Which, of course, I do...
Which leads to a related question: how do you lay out SQL (and maybe other code, although most languages have conventions) so that you can get immediate visual-cortex input into your first read-through of the code, rather than mumbling through the text and waiting for the words to come together and give you an overview of the logic structures?
no subject
Date: 2007-04-25 01:17 pm (UTC)I could, I suppose, configure it to highlight variables with a particular prefix, since that can be done at the purely lexical level. However, you specified "easily", and it certainly wouldn't qualify as that: I'd have to reimplement chunks of the standard C mode in my
.jedrcand have them override the normal version. Also, I'd run out of colours.As for "should" ... I'm not sure. It's possible that I might find uses for such functionality if it could be easily done; but I've never felt its lack. More generally, one might present various arguments against making syntax highlighting too complicated:
- it would slow the editor down
- it would encourage people spending more time configuring their highlighting scheme and less time coding
- the closer the editor comes to fully understanding the source language, the more people will tend to work on the assumption that it will always agree with the compiler, leading to significantly greater inconvenience on the few occasions when it doesn't
- writing editor modes for new languages becomes a lot more effort.
On the whole I think I'm happy with the level of highlighting I have now: simple to implement for a new language, quick to perform during editing, and relatively robust in the face of things the editor doesn't understand.no subject
Date: 2007-04-25 01:22 pm (UTC)Plus, I tend to find that highlighting draws my attention sufficiently that I can't read the non-highlighted stuff without disproportionate effort, so it tends not to actually be all that helpful.
This may change if I had to create larger projects.
no subject
Date: 2007-04-25 02:17 pm (UTC)*Apart from some Basic as a small child (well under 12 anyway when we moved onto an A3000 from the electron).
no subject
Date: 2007-04-26 08:39 am (UTC)I have it set to distinguish built-in types from types defined somewhere in my solution, but no more distinction between variable types than that, and no highlighting on the actual identifiers.
There's a system for highlighting variables with certain prefixes but I tried prefixing my variables once and didn't like it much, and with comprehensive Intellisense / go-to-definition there isn't much point (the information is sufficiently close-to-hand that prefixes are just clutter).
The code highlighting plays well with the very limited C# preprocessor and would probably handle C preprocessor if I put it in C++ mode.
There are about a million different extra highlighting options that I have turned off because I ran out of non-distracting, easy-to-read, easily-distinguished, pleasant colours. But it's nice to know they're there - if I had a different code-base I'd probably use different features.