Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Option to underline non-symbol backticks

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
BillyONeal Posted - Jul 11 2013 : 12:27:44 AM
I've gotten into the habit of delimiting symbols in comments using backticks (`), because that's how one does it in Markdown (Stack Overflow).

I had some code like this:

List<IBorder> borders = GetBordersToValidate(allBorders);

/* ... */

// Connectivity is the function f(x, y) => IsConnected(x, y), where x and y are border indices from `borders`
bool[,] connectivity = new bool[borders.Count, borders.Count];


Later, "borders" was renamed to "bordersToValidate", giving this:


List<IBorder> bordersToValidate = GetBordersToValidate(allBorders);

/* ... */

// Connectivity is the function f(x, y) => IsConnected(x, y), where x and y are border indices from `borders`
bool[,] connectivity = new bool[bordersToValidate.Count, bordersToValidate.Count];


Now the comment doesn't make sense.

It would be neat if there was a switch one could turn on that would treat the items in backticks as symbols, and underline them as misspellings if no such symbol exists. (This could possibly be extended to the hungarian, underlined_symbol, and pascalCase detection already in the spell checker)

(I know this probably won't happen and is really really minor but figured I'd throw it out there...)

Billy3
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Jul 12 2013 : 4:30:44 PM
The problem here is that comments are free form text, plus they are often outside the scope of the variable or function they are referencing.

In your example "borders" is a normal English word, so it is likely to be used both to reference this variable, and just as a normal word. If the comment was next to the variable then I would expect VA to suggest renaming it. But if the comment was noticeably distant from the variable, then its less clear that it is connected.

Assuming for the moment that we compare all words in back quotes to our list of symbols, this is going to run into some problems with local variables when the comment is not at the same scope as the variable. Is the reference to the variable valid or not? What about duplicate variable / symbol names? The reference you intend may no longer exist, but another reference may be found.

Are you seeing a lot of instances where VA's Rename command cannot work out that a comment should be updated? This might be the better place to focus, it might be a better defined problem.
BillyONeal Posted - Jul 11 2013 : 3:02:21 PM
feline,

The references that refer directly to the symbol (e.g. XML doc comments) do get updated automatically, and the option to show places that might refer to the symbol is there. The heuristic method has caused me to automatically rename things that should not have changed in the past though, so I usually leave it off.

Billy3
feline Posted - Jul 11 2013 : 11:46:56 AM
How are you renaming the symbol "borders"? If you are using VA's rename refactoring command, you can tell VA to show all references in comments and strings, and once shown these references can be updated by VA as well. So your comments will be kept up to date.

http://www.wholetomato.com/products/features/rename.asp

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