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
 Technical Support
 How should I handle spurious hashtags?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jschroedl
Ketchup Master

USA
91 Posts

Posted - Apr 13 2015 :  08:35:54 AM  Show Profile  Reply with Quote
I am trying out the new VA Hashtags feature and it's somewhat promising but we have a snag with some code which does XML parsing.

We have a lot of comments similar to this excerpt:

/**
 * IS_EXTENDER:
 * @c:  an UNICODE value (int)
 *
 * Macro to check the following production in the XML spec:
 *
 *
 * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
 *                   #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
 *                   [#x309D-#x309E] | [#x30FC-#x30FE]
 */


Unfortunately, that leaves me with a whole truckload of tags which aren't really tags in the VA Hashtags list.

Any advice? I'd rather not touch these comments as they are correct (and not my code).



accord
Whole Tomato Software

United Kingdom
3164 Posts

Posted - Apr 13 2015 :  10:32:43 AM  Show Profile  Reply with Quote
Yes, since VA Hashtags have a short tag, a hash, you will have some unrelated stuff as well in your code. Personally, I love the fact that this solution is short, elegant, and works the same way as hashtags anywhere else.
But yes, I will not pretend that this is not a real problem. What I usually do is just filter using the editbox on the top of the VA Hashtags window. If you press alt+shift+h (the shortcut for VA Hashtags) the window will be opened (or get focused if it was already open) and the filter editbox will have focus so you can type right away.

One solution would be to change the tag other than just a hash, but I wouldn't do that. It's simple, it's intuitive, other devs can use it, project and company independent, etc.
Filtering is fine for me because I wouldn't usually need other's hashtags since hashtags can be kind of personal to some extent, since they're like bookmarks. Other times when you try to find something in the code, filtering is also great.

But if you really don't like the unnecessary items, one solution would be to implement so users could use a list of permanent negative filters in the form of regular expressions that would filter out unnecessary stuff. A downcase 'x' and 2 upcase hexa numbers or a downcase 'x' and 4 upcase hexa numbers, in you case.

What do you think?

Edited by - accord on Apr 13 2015 10:34:21 AM
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Apr 13 2015 :  11:58:25 AM  Show Profile  Reply with Quote
You can also change the default value of HashtagsMinTagLength from 3 to 6.

Edited by - sean on Apr 13 2015 12:00:25 PM
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Apr 13 2015 :  12:11:24 PM  Show Profile  Reply with Quote
#4E00 is not considered a hashtag because it is a hex value. The x is causing that check to fail in #x4E00. case=89057

Edited by - sean on Apr 13 2015 12:11:52 PM
Go to Top of Page

jschroedl
Ketchup Master

USA
91 Posts

Posted - Apr 14 2015 :  07:16:05 AM  Show Profile  Reply with Quote
Thanks for the good responses.

Thanks for adding a case for the #x. Here's the spec mentioning that it's a valid character reference (in case it comes up): http://www.w3.org/TR/REC-xml/#dt-charref

After using this for the day, I'm with @accord now and I've set the filter to a prefix for what I'm interested in and things seem perfectly usable.

I like the option of upping HashtagsMinTagLength in case this becomes annoying for other devs on the team.

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
15984 Posts

Posted - Apr 14 2015 :  7:08:08 PM  Show Profile  Reply with Quote
Adding the ability to exclude some tags from the list makes sense, and is worth considering. I have put in a feature request for this to see what our developers make of it:

case=89098

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

nitz
New Member

7 Posts

Posted - Apr 16 2015 :  09:57:18 AM  Show Profile  Reply with Quote
I have the sqlite.c code in my project. It has some comments in my code that are like: #AAAA (which is a hex value), and that shows up as a hashtag. (Though from sean's comment, I feel like it shouldn't!) It also uses some other things that get registered as hashtags that shouldn't (as like #NNN for describing a number.) It'd be lovely if we could add rules (say maybe, regular expressions, that if they match, the hashtag is skipped?) to attempt to de-clutter?


As well, if a comment has a url in the that looks something like

// visit this link http://example.com/page.php#faq_18


Then a hashtag will show up for faq_18.

Perhaps hashtags should be ignored if they're part of a URL like that? That's obviously a very specific case, but not completely uncommon.

Cheers
Go to Top of Page

holedigger
Whole Tomato Software

145 Posts

Posted - Apr 16 2015 :  11:34:28 AM  Show Profile  Reply with Quote
In the case of #AAAA it isn't ignored because there are no digits, the same reason we don't ignore #deadbeef or #face. Perhaps we could ignore #AAAA because it is ALLCAPS? But that doesn't help #NNN.

We have tried to minimize spurious tags, but we are exploring ways of explicitly excluding them. In addition to a tag-by-tag filter (ie, regex) would you want to exclude by file? by project?

Whole Tomato Software
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Apr 16 2015 :  1:30:52 PM  Show Profile  Reply with Quote
The faq_18 problem in sqlite source is case=89145.

VA excludes uses like this:
// ** [http://nfs.sourceforge.net/foo#faq_a8]

But the check in the sqlite code case is failing because there is no letter between / and #:
// ** [http://nfs.sourceforge.net/#faq_a8]
Go to Top of Page

nitz
New Member

7 Posts

Posted - Apr 16 2015 :  1:34:59 PM  Show Profile  Reply with Quote
My gut instantly says by file would be the most useful quickly. (Especially if I could ignore by wildcard patterns, such as "sqlite*", or ignore all C files by "*.c", etc.

As for excluding entire projects, I could see that being handy when I just wanted to focus on projects I'm responsible for.However, using the filter in the VA Hashtags window would probably get me where I wanted to go faster than trying to add a project to ignore anyways. Not to say that it wouldn't be useful though, so if we were using a project developed by someone who also made extensive use of hashtags, we could easily disregard them. I definitely see the benefit of it.

@sean: Good catch! I didn't even notice that myself.

Edited by - nitz on Apr 16 2015 1:35:49 PM
Go to Top of Page

sean
Whole Tomato Software

USA
2641 Posts

Posted - Jun 11 2015 :  2:43:08 PM  Show Profile  Reply with Quote
case=89057, case=89145, case=89172 and case=89445 are implemented/fixed in build 2068
Go to Top of Page

pwc
Tomato Guru

133 Posts

Posted - Jul 23 2015 :  11:26:00 AM  Show Profile  Reply with Quote
We happened to have a few hundred occurrences of #blah in our code base. I'd like the option to use an alternate character or character sequence. I'd probably try ##.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000