Author |
Topic |
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 15 2004 : 5:37:35 PM
|
For complex string sequences with lots of escape sequences it would be really nice to have the sequence under the cursor highlighted. Like in:
pszText = _T("\\nuhm, some \\\\\\"text\\"\\\\\\n"); where the caret is between the slash and the second quote. Same for highlighting octal and hex sequences like in:\\01010101lI??!\\\\x80\\x80 with the cursor in the first octal sequence. This really would help in almost any C/C++ string which contains any type of sequence.
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 16 2004 : 06:27:53 AM
|
who do i have to bribe to get this??? |
zen is the art of being at one with the two'ness |
|
|
WannabeeDeveloper
Tomato Guru
Germany
775 Posts |
Posted - Mar 16 2004 : 06:55:33 AM
|
I'd like to get one step forward: Color EVERY Escape Sequence, not only those with the caret between...
|
|
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 16 2004 : 06:58:14 AM
|
that would of course be even better, especially since it would help to highlight incorrect escape sequences in strings |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 16 2004 : 09:20:30 AM
|
That would look like a rainbow, or if everything is the same color, render it useless. |
|
|
WannabeeDeveloper
Tomato Guru
Germany
775 Posts |
Posted - Mar 16 2004 : 09:25:13 AM
|
So make it cycling in brightness (of course the User should be able to select the color). Let's say the User chose RED as color.
First Escape-Sequence: RED Second: Darker RED Third: even darker RED Fourth: RED again...
...and so on.
In your example: pszText = _T("\\r\\nuhm, some \\\\\\"text\\"\\\\\\r\\n");
|
|
Edited by - WannabeeDeveloper on Mar 16 2004 09:27:55 AM |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 16 2004 : 09:27:57 AM
|
ah, i think i see your concern. what about something like this:
pszText = _T("\\r\\nuhm, some \\\\\\"text\\"\\\\\\r\\n");
which is what i had imagined. i would end up with three colours, since i have my strings coloured that pink colour. the shade took a bit of getting used to, but i like to be able to easily spot strings |
zen is the art of being at one with the two'ness |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 16 2004 : 09:32:24 AM
|
quote: Originally posted by WannabeeDeveloper
So make it cycling in brightness (of course the User should be able to select the color).
personally i would be happy with one colour for the escape codes, and a second colour for the "current" escape code. i find this (yet again in vim) useful for things like:
debug("checking the values\\na = {%d}\\nb = {%d}\\nc = {%d}", a, b, c); |
zen is the art of being at one with the two'ness |
|
|
WannabeeDeveloper
Tomato Guru
Germany
775 Posts |
Posted - Mar 16 2004 : 09:36:46 AM
|
Agreed... Maybe another Idea: Since VA_X already hijacks the Code-Window, it could also (easily?) replace "known" Escape-Sequences with symbols from a Symbol-Font... but maybe this would be too confusing... maybe coloring them is enough... |
|
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 16 2004 : 09:48:14 AM
|
*um* what sort of symbols were you thinking of? what about things like:
debug("value a: %06.2d", a);
my gut reaction is that symbols would be very confusing. however, if you have an example of how it might make sense...
also, wouldn't mixing fonts in the editor window be asking for trouble? |
zen is the art of being at one with the two'ness |
Edited by - feline on Mar 16 2004 09:49:05 AM |
|
|
WannabeeDeveloper
Tomato Guru
Germany
775 Posts |
Posted - Mar 16 2004 : 09:52:20 AM
|
Yup, it probably would...
I thought of the "simple" Escape-Sequences (like \\t, \\n etc). Maybe a "TAB" in a single character (I think there is a ANSI-Code for that, not sure, though), or an arrow like on the enter-key for \\n or something like that.
Might be too confusing, though... |
|
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 16 2004 : 10:33:22 AM
|
Naaah, that would really be too much and go too far from the C/C++ Language definition. Just simply highlightning of sequences would be very helpful. (But for the %06.2d sample another idea is coming up. You know the "Format Cell" command in Excel? I'd like to see a "printf expression builder" in the context menu. ) |
|
|
support
Whole Tomato Software
5566 Posts |
Posted - Mar 16 2004 : 10:34:15 AM
|
Mixing fonts in the source window is not really an option. We do not have enough control over the IDE to make that happen.
The IDE updates the source window in some ugly ways. It is one reason why coloring doesn't always work -- the IDE paints text in ways we do not expect. There must be 50 ways... Localized IDEs, language packs and IDEs with non-US English languages settings give us the most trouble. We could devote all of our resources to coloring and make a product that did only that. We sometimes wonder if that would be better than offering so many features -- each of which does not work for someone. But, every developer deals with the same issue.
We still have a problem with tri-colored text. Top, middle and bottom are different colors. Go figure.
As for coloring of escape sequences, we like the notion of distinguishing them. Keep discussing the topic. If we do anything, we will consider ease of implementation and level of quality when selecting an approach. |
Whole Tomato Software, Inc. |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 16 2004 : 10:39:07 AM
|
That sounds like "come up with a reasonable implementation and we do it" I imagine that this rather simple sounding feature requires lots of changes to the parser (it does not yet parse the contents of strings) and also the internal data structure which represents the code (it has no representation for string contents, only for the string as one entity) and of course the coloring engine. Its probably at least a week of work and lots of testing. Right?
... but it would be so nice... |
|
|
WannabeeDeveloper
Tomato Guru
Germany
775 Posts |
Posted - Mar 16 2004 : 12:13:45 PM
|
Hmm... does anyone know a huge company that would buy 50.000 Licenses only if this feature would be implemented?
Unfortunately, I don't... but, if I hadn't already bought VA .NET, I certainly would (after you implemented this feature, of course)!
Is that convincing enough?
Leon, could you explain your idea of the "printf expression builder" a bit more? I am not sure what you mean with that... but it sounds great...
Or, wait a moment....
As soon, as you press "%", an autotext Popup could appear suggesting %d, %i etc., but only if it's within quotation marks ("). Is that what you meant?
Now if I only knew a huge company... |
|
Edited by - WannabeeDeveloper on Mar 16 2004 12:23:09 PM |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 16 2004 : 12:40:07 PM
|
Well, kind of. Yes. A nice small dialog where you can choose formatting options, choose the format type, precision, etc. Just like in Excel. |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 17 2004 : 09:01:26 AM
|
i suspect such a dialogue is asking to much for the first version of this.
locating the standard escape sequences inside of strings shouldn't be to hard. i believe that VAX already knows which things are strings, since i recall a comment about a special case strings being processed by _T()
all of the examples so far look like C and C++ code. do these sort of escape sequences turn up in other languages VAX handles? something to at least consider.
the easiest initial solution would be to have a single colour and to highlight all escape sequences in this colour, ignoring the cursor position. this saves on having to update the screen as you move the cursor around. i am guessing that the wizard bar is easier to update constantly, since this is independent of the source code window.
this shouldn't add much overhead to the syntax highlighting in most cases, since most of my code doesn't have strings with escape sequences in it.
Uniwares how useful would seeing all of the escape codes highlighted be? i am hoping this will be a start point, so that VAX can slowly expand its features here over time |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 17 2004 : 09:32:11 AM
|
I'm not sure that it really would be helpful to see ALL sequences shining brightly in various colors. I fear that its too "colorful" even with different shades (Uhm, could we also have nicer tomato icons in various shades of red?).
Of course, the "printf format builder" is asking very much indeed. It was just a side-suggestion |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 17 2004 : 09:43:55 AM
|
i meant all of the escape sequences in the same colour, and the same shade.
a second colour for the escape sequence you are currently editing would be very nice, if we can get it |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 17 2004 : 10:39:04 AM
|
Well, the point is that when you have consecutive sequences, the hightlightning looses its value because you have just a sequence of colored characters and again you dont see the escape sequences. e.g. (sequences in blue): ... = "\\r\\n\\t\\t%16I64x\\t%2.2d%%\\"%-10s\\""; |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 17 2004 : 11:13:13 AM
|
this is true. most of my strings aren't quite so full of escape sequences.
i am trying to workout the minimum amount of work for VAX that will give us most of what we want. do you tend to have solid sets of escape sequences like this? or are you more prone to escape sequences scattered through a string.
i still love the idea of highlighting the current escape sequence, but i suspect this may be a fair amount of work / overhead. |
zen is the art of being at one with the two'ness |
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 17 2004 : 2:59:07 PM
|
I'd say that most sequences are either simple "\\r\\n" where it makes not much of a difference if you highlight them or not, or the total opposite - complex formatting strings - like the prevous example. I'd say that's a fifty-fifty.
I guess the work to highlight the current sequence is about as complicated as the matching brackets highlightning is already. |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 17 2004 : 6:05:06 PM
|
my strings tend to be slightly less heavy on the escape sequences, but not all of them.
i agree that parsing the strings should be a doddle given what VAX already does
the obvious issue is going to be performance. if this is a concern with highlighting the current escape sequence as you move the keyboard cursor through the string, what about the mouse cursor?
personally i am keyboard centric, so i am not that keen on this, but it is a halfway house. mouse hover events already trigger tool tips, and if you are hovering the mouse you aren't typing at full speed, so using up a load of CPU cycles arguing with the IDE isn't an issue.
as you hover the mouse pointer over a part of the string, highlight the entire escape sequence that you are over in the chosen colour.
further, if you are hovering over a string with escape sequences, but not actually over an escape sequence then highlight the closest escape sequence in the chosen colour. |
zen is the art of being at one with the two'ness |
|
|
Stephen
Tomato Guru
United Kingdom
781 Posts |
Posted - Mar 18 2004 : 04:16:53 AM
|
We seem to be talking both about escape sequences (e.g., \\r) and printf conversion specifications (e.g., %d).
It seems to me that colouring conversion specifications is more useful, but probably much harder because you have to know that a printf format string is expected. You don't really want to go around colouring a %d that happens to occur in any old string. But how do you know whether a string is going to be used as a printf format in the future? (Of course, if you're prepared to put up with false positives, this problem goes away.)
|
Stephen Turner ClickTracks http://www.clicktracks.com/ Winner: ClickZ's Best Web Analytics Tool 2003 & 2004
|
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Mar 18 2004 : 07:22:23 AM
|
off the top of my head, i don't think i ever use printf conversion specifications outside of strings destined for printf, etc. |
zen is the art of being at one with the two'ness |
|
|
Stephen
Tomato Guru
United Kingdom
781 Posts |
Posted - Mar 18 2004 : 07:38:45 AM
|
I suppose in normal text one would normally have a space after a percent sign, so maybe the false positives are rare enough to be acceptable. |
Stephen Turner ClickTracks http://www.clicktracks.com/ Winner: ClickZ's Best Web Analytics Tool 2003 & 2004
|
|
|
Uniwares
Tomato Guru
Portugal
2322 Posts |
Posted - Mar 18 2004 : 1:44:47 PM
|
Think so too. Besides, strings which are not being used as formatting string are always in a resource file, right? Or? Dont tell me you are STILL hardcoding strings into your source code. |
|
|
Stephen
Tomato Guru
United Kingdom
781 Posts |
Posted - Mar 18 2004 : 2:01:00 PM
|
You're right, we're not! |
Stephen Turner ClickTracks http://www.clicktracks.com/ Winner: ClickZ's Best Web Analytics Tool 2003 & 2004
|
|
|
|
Topic |
|