Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Enable Highlighting of custom Functions/Macros

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Kastenfrosch Posted - Jun 29 2016 : 06:02:46 AM
It would be cool if i could add custom rules for Syntax highlighting.

In my special case i would like to paint all lines like
assert(myCondition);
ASSERT_MACRO(myCondition, "my Text");

in a gray tone (as they are not relevant for the reader most of the time).

In general it could also be great to add custom Regexps that are highlighted in a user defined color.
7   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jul 05 2016 : 4:17:29 PM
Yes, I had not considered that, but the #pragma lines do cause problems for other editors, and if you are not using them the same way, they do simply increase the noise in the code.

This is possible, but very tricky, since it requires considering the entire line, and overriding all the other colouring rules at work on these lines.

Are you able to group the assert together into a single block, perhaps at the start of the function, along with the variable declarations, to help with recognising these as "minor" lines?
Kastenfrosch Posted - Jul 05 2016 : 2:56:53 PM
Hey Feline!

Thanks again for your suggestions!
The #pragma region thing is a funny hack, considering that it yields exactly the grayed-out appearence, that i asked for.

However, for a real nice solution it has too much flaws (coworkers will see all lines collapsed out, copy paste will remove the collapsing, i have to make sure that the region name and the code are always in sync, other editors or views (like merge tools) won't interpret the regions, ...).

If it's hard to implement in VA, i guess i'll just try to live without it, training my brain to automatically ignore all those lines :).
feline Posted - Jul 05 2016 : 2:18:28 PM
Another thought, along the same lines. Have you ever considered wrapping the assert lines like this:

#pragma region assert(myCondition);
assert(myCondition);
#pragma endregion

#pragma region ASSERT_MACRO(myCondition, "my Text");
ASSERT_MACRO(myCondition, "my Text");
#pragma endregion


it is a bit bulky, but it gives you a block that you can collapse, and once the block has been collapsed, the region name (the end of the #pragma region line) is shown in pale text. Even more usefully, VS2015 remembers which blocks you have collapsed in a file when you reload the file or the solution, so once collapsed, these blocks will stay collapsed, until or unless you need to open them up and edit them.

Converting the existing assert lines like this could be done with a VA Snippet, or a find and replace, if you wanted to. It is a code change, and a fuss, but its something you can do right now, and it seems effective and reliable.
Kastenfrosch Posted - Jul 01 2016 : 10:53:24 AM
Hey Feline!

Thanks for your suggestion!
But i think the disadvantage, that i cannot read the collapsed lines anymore keeps me from using this method.
Especially as we have ASSERT_OR_EXECUTE(condition, errorCaseStatement) in many places it would be a hassle to manually have to uncollapse these statements everytime.
feline Posted - Jun 30 2016 : 8:38:43 PM
This is what I was concerned about. Picking out just the function in a separate colour is not to big a jump from what already happens, but here you would need to change the entire line, and thus override any colouring that is being applied to the parameters.

Collapsing the lines, if this might work, the collapse its self can be somewhat automated. I wrote an IDE macro to do this in VBScript, which is available here:

https://wholetomato.fogbugz.com/default.asp?W444

it would not be difficult to update the macro to find and collapse these lines. Getting the IDE to run a macro is a different question, but I did read that Microsoft has released an addin for VS2015 that provides IDE macros, since they are no longer built in.
Kastenfrosch Posted - Jun 30 2016 : 3:23:11 PM
Hello Feline!


quote:
Are you talking about the function / macro "assert" and "ASSERT_MACRO" only, or the entire line of code?


In my case both options "tint full statement that contains function name" or "tint function name and all its arguments" would yield the desired result. As you mentioned, only tinting the function name would not be sufficient.

quote:
Do these lines come in blocks, or are you looking at occasional isolated lines of code?


In my case, there are single lines that just state "ASSERT_MACRO(myCondition, "my Text %i, %i", 1, 2);" everywhere in the code.


quote:
If there are blocks I am wondering if using the editors outlining features to "hide" the lines might make more sense.


Unfortunately this comes with drawbacks, like "in case i want to see the line i have to uncollapse" and "i have to manually do the collapse for every single occurence"
feline Posted - Jun 30 2016 : 2:55:45 PM
Are you talking about the function / macro "assert" and "ASSERT_MACRO" only, or the entire line of code? This makes sense, but if you simply "dim" the function name, then the parameters are still going to be shown normally, drawing your eye to a line of code where the parameters stand out but the function does not.

Do these lines come in blocks, or are you looking at occasional isolated lines of code? If there are blocks I am wondering if using the editors outlining features to "hide" the lines might make more sense.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000