Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Option to underline non-symbol backticks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

BillyONeal
New Member

USA
6 Posts

Posted - Jul 11 2013 :  12:27:44 AM  Show Profile  Reply with Quote
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

Billy3
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor, BleepingComputer.com

feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Jul 11 2013 :  11:46:56 AM  Show Profile  Reply with Quote
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

zen is the art of being at one with the two'ness
Go to Top of Page

BillyONeal
New Member

USA
6 Posts

Posted - Jul 11 2013 :  3:02:21 PM  Show Profile  Reply with Quote
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

Billy3
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor, BleepingComputer.com
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Jul 12 2013 :  4:30:44 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000